Expand|Select|Wrap|Line Numbers
- Smith 9 9.33 8 10 5.5 8 10 20 47.5 47 45 47.5 48 83 87 100 98
- 96 100 98 92 88 96 92 86 92 94 100 96
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <string>
- #include <vector>
- #include <fstream>
- using namespace std;
- using std::ifstream;
- using std::ofstream;
- //Structure for holding all the grades
- struct Grades
- {
- string student;
- float quizzes[7];
- float projects[6];
- float exams[2];
- float labs[14];
- };
- int main()
- {
- Grades a, b, c, d, e;
- string line;
- ifstream myfile("grades.txt");
- if (myfile.is_open())
- {
- if (! myfile.eof() )
- {
- getline (myfile,line);
- int i = 0;
- while (isalpha(line[i]))
- {
- a.student += line[i];
- i++;
- }
- for (int h = 0; h < 7; h++)
- {
- a.quizzes[h] += line[i+1];
- i++;
- }
- }
- myfile.close();
- }
- else cout << "Unable to open file";
- }