Code:
Here are the program requirements and what it should do.
Your program will read in a number of student grade records from a file (stdin), with each grade record including (potentially) multiple exam scores. So, for example, you might read data for 200 students that include scores for each of 4 different exams. The exact number of students and exams will be specified in a constants.h file that I will provide. For example, the constants.h file might look like
#define NUMBERofSTUDENTS 200
#define EXAMSCORES 4
Your program would then read the 800 exam scores and store them in a two-dimensional array, declared as
int scores [NUMBERofSTUDENTS][EXAMSCORES];
I don't care what variable name you use for your array. I used scores here, but that is up to you. However, you WILL need to use the names NUMBERofSTUDENTS and EXAMSCORES as those will be names I'll use in constants.h.
Here is what your program will do:
Calculate and print the "class" average for each set of exams (So, for our "example" of four exam scores for each student, you'd print 4 different class averages, one for each exam.)
Calculate and print the median exam score for each set of exams.
Print a histogram of the scores found for each set of exams.
Calculate and print the average of all exam scores for each student record (So, again for our example, the average of the 4 exams for each student.)
Calculate and print the average of the averages of the students (so the average for all 800 exam scores in our example.)
To do some of these things, you'll need to sort the individual (4?) exam scores, for example to find the median and to print the histogram. You can use the bubble sort function that I've written for class. You can even use the histogram function that I've written for class. Bear two things in mind, however, namely
Both the bubble and histogram function(s) are written to work on a single-dimension array. You'll have to determine how to pass a one-dimensional array for each group of exam scores.
You cannot change the order of the exam scores in any column of your two-dimensional array since that would have the effect of changing the scores (and averages) for each student.
Luckily, each of those concerns can be addressed easily using techniques we'll discuss in class.