writing a program that averages test scores

I am unsure about how to start this program. I need to write a program that reads a file consisting of students' test score in the range 0-200. please help I need to get this done today.
the input data for this program is:
76
89
150
135
200
76
12
100
150
28
178
189
167
200
175
150
87
99
129
149
176
200
87
35
157
189
the ranges for this program is:
0-24
25-49
50-74
75-99
100-124
125-149
150-174
175-200
This program also has to be a file that me how many student fall into each range please help.
start with how you would do it on paper, then it should be easier to program.
maybe a struct holding a sum of scores falling into the range and a number of students

1
2
3
4
5
struct range
{
       int sum = 0;
       int students = 0;
}


make an array of 8 range structs (one for each range)

then loop through the file reading numbers and the trick that could work - divide each number by 25 and use that result (int) as an index of that structs array
for instance: 149/25 = 5 or 178/25 = 7
Last edited on
Topic archived. No new replies allowed.