Okay I need to create this Program and I have no Idea where to start.

you will write a program that performs a threshold filter on a sequence of one-dimensional data.

A threshold filter replaces values in an array with preset constants based on whether the values are in the "upper", "middle", or "lower" range of the data. We will use these constants for this particular assignment:

Range

Replacement

a[i]>90%


a[i]=2;

10%<=a[i]<=90%


a[i]=1;

a[i]<10%


a[i]=0;

Requirements

You must use a one-dimensional integer array to hold the data, it should hold up to 64 data points.

Always open a file named "DATA". The format of the file is stated below.

Read the size of the sequence, checking for an input error with something like if( !(inf >> size) ), which would signify a bad data file.

Read size data values into your one-dimensional integer array, if there is an input error, print an error message and exit(1) the program.
You may check that each array element is read from the input file successfully, or

After the data elements have been read, you may use if( !infile ) to detect an input error.

Scan through the array to find the maximum value in the array (only scan through size elements!).

Calculate two double thresholds at 10% and 90% of the maximum value.
Iterate through the array, replacing each element value with either a 0, 1, or 2 depending on the replacement table above.
Finally, print the elements of the new array to the console window. Print them all on one line, without intervening whitespace.

File Format & Example

An example data file looks like this (you might want to copy and paste this line into NOTEPAD and save as DATA to begin your application development):

6 0 10 2 0 10 4

Where the first digit specifies how many data elements follow.
The number of data elements (the first value) will not exceed 64, and all data elements will be greater than or equal to zero.

These six data points would have a maximum value of 10, so the two thresholds would be 1.0 and 9.0 respectively. After filtering to 0, 1, and 2, the data array would have values

{ 0, 2, 1, 0, 2, 1 }

and they would print out the string 021021 to the console.

Well to do this you need to know about arrays. Then you can check out here to find out how to open a file. You will either want to use a max function like std::max or you could use your own to find the max number in the array. Remember to start small. You can always write a function and just test that one thing to make sure that it is working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.