ThresholdDataFunction

This assignment is derived from the official assignment.

This assignment re-implements ThresholdData using functions.

Review the previous assignment write-up and the solution you submitted before beginning this assignment.

You may also refer to this example of the old assignment.

Requirements

  1. The main() routine should read data from a file named "DATA".
  2. All the element processing requirements in ThresholdData original assignment.
  3. Your application should implement 4 utility functions. Incorporate these into the application using function definitions above main.
    1. Your application should have a readData() function with the following signature:
      istream& readData(istream& inputfile, int dataset[], int& size)
      Where inputfile is the input filestream (passed by reference) that should also be returned to the main routine, dataset is the array to place data into, and size is the number of elements read into the array.
    2. Your application should have a findMax() function that accepts an int dataset[] parameter and an int size parameter. This findMax() function should return the value of the maximum data point as an integer.
    3. Your application should have a discretize() function that returns void, and accepts an int dataset[] parameter, an int size parameter and two double values representing the low and high threshold boundaries.
    4. Your application should have an function called outputData() that returns void and accepts an int dataset[] parameter, and an int size parameter for the number of valid array elements. This function should print the discretized values to the screen.

In a Nutshell

You are simply refactoring the original ThresholdData program to use functions. There are four steps, right? Put the data in the array; find the max value so you can determine the threshold boundaries; discretize the values into 0s, 1s and 2s; and output the discretized values.

Grading

See the official assignment.

This is due by midnight, Nov 2 2009!