Start by thinking about the data that you'll need. In this case you need the array, and the number of elements actually in the array:
1 2 3
|
const int SIZE=99;
unsigned numItems;
int numbers[SIZE];
|
Now what sort of things do you need to do:
- read the array
- sort the array (to find the mode and median)
- find the mode
- find the median
- find the mean
Some/all of these will probably turn into functions.
Now
reread the assignment. See if you've missed anything or if you have any questions. As I re-read it I find:
- display unsorted and sorted array.
- at least 4 functions, at least 3 returning void.
- all output displayed in main program
- Prompt user for input file.
- when printing array, max of 40 per line.
- Question: what does prof mean by "response/frequency histogram"? Do you need to display a histogram of the data?
Now write prototypes for some functions and comments that describe what they do. Create the main program and write a series of comments to describe what it will do Can it do everything it needs to?
Read the assignment again and repeat the previous step Keep going until you're pretty sure you have everything you need.
Now you just have to fill in the code underneath your comments.