a. Create a txt file named “x” that contains students’ test scores in the range 0~100. Assume
test scores are integers. You can use the following sample data:
(76 84 75 62 58 75 93 54 36 87 81 88 68 90 73 80 74 84 96 100 61 50 84 47 92 87 76 87 82
64)
b. Write a program that reads the scores from file “x”, find the total number of scores, and determine the number of scores in each of the following ranges:
1) 0‐50 (0 <= score < 50)
2) 50‐55 (50 <= score < 55)
3) 55‐60
4) 60‐65
5) 65‐70
6) 70‐75
7) 75‐80
8) 80‐85
9) 85‐90
10) 90‐100 (90 <= score <=100 Notice: 100 is included in this range)
Output the score ranges and the number of students in each range. Your program should be able to read
any number of test scores.
Here is what I have so far:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ofstream myfile;
myfile.open ("x");
myfile << "C:\\Users\\Me\\Desktop\\x.txt";
myfile.close();
system("pause");
return 0;
}
|
I honestly have NO idea how to go about doing this next part.