Homework 19: Due Thursday, December 7th

Complete the following problems:

1.  Write a function called lessThan that has three parameters:
      a one dimensional array of floats called nums
      an int n which is the size of the array
      a float amount
    The function should return the number of elements in nums which
    are less than amount


2.  Write a prototype for the lessThan function.


3.  Write the statements to call lessThan from problem 1 and print the
    number of elements which are less than amount.


4.  Write another function called lessThan that has two parameters:
      a two dimensional array of floats called nums
      a float amount
    The function should return the number of elements in nums which
    are less than amount. Assume that global constants ROWS and COLS
    have been defined, and that ROWS is equal to the number of rows
    in nums, and COLS is equal to the number of columns in nums.


5.  Write a prototype for the lessThan function from problem 4.


6.  Write the statements to call lessThan from problem 4 and print the
    number of elements which are less than amount.


7.  Given a 10 x 10 array of ints called matrix:
      A.  write the statements to compute and print the sum of the
          elements in row 4
      B.  write the statements to compute and print the sum of the
          elements in column 3
      C.  write the statements to display the elements in the following
          order: the first output line will be column 9, the second
          output line will be column 8, the third output line will be
          column 7, and continuing, until the last output line will
          be column 0

8.  Write a function sum_up_row that is passed a 2-dim array named
    TABLE containing floats. It should return the sum of the elements of
    a specified row. The specified row will be a parameter called
    specifiedrow. The number of columns in the array is COLUMNS.


9.  Write a prototype for the sum_up_row function.


10. Write the statements to call sum_up_row to add up the third row of
    a 2D array named table, and then print the sum.

Remember to type your answers and to make two copies of each homework assignment. One copy is submitted to me and the other you keep to use in the group discussions.


Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2004