Tom Kelliher, CS17
May 6, 1996
We'll skip 2-D arrays.
As promised, sample input data:
100 75 100 80 75 100 70 -1 85 55 60 85 110 70 75 85
Example output:
File name: grades.in Rejected illegal grade: -1 Rejected illegal grade: 110 Number of accepted grades: 14 Max grade: 100 Average grade: 79.6429 Median grade: 77.5 As: 3 Bs: 4 Cs: 5 Ds: 1 Fs: 1 Standard deviation: 13.5573 File name: grades.out
Suggested list of functions:
int getInputs(int data[], int size);
--- Discussed previously.
Reject any grades less than 0 or greater than 100.
void putOutputs(int data[], int size);
--- Discussed
previously.
void sort(int list[], int size);
--- Discussed previously.
void swap(int& a, int& b);
--- Discussed previously.
int getMax(int data[], int size);
--- Work on this yourself.
double getAverage(int data[], int size);
--- Work on this
yourself.
double getMedian(int data[], int size);
--- Assume data is
sorted. Two cases:
void getHistogram(int data[], int size, int& numAs, int& numBs,
int& numCs, int& numDs, int& numFs);
---
Notes:
double getStdev(int data[], int size);
--- Notes: