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
Jones 9 8 6 6 8 7.5 8 20 35 40 42.5 40 44 62 72 100 88 86 90 92 92 88 86 88 86 94 88 86 90....etc i don't know how many students their will be.
And I need to store them in a structre like how I have in my code...Im unsure how to get all the input to go into each of these arrays . ANy help will be greatly appreciated..heres wha i have so far.
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <string>
- #include <vector>
- #include <fstream>
- using namespace std;
- //Structure for holding all the grades
- struct Grades
- {
- string student;
- float quizzes[7];
- float projects[6];
- float exams[2];
- float labs[14];
- };
- int main()
- {
- ifstream inFile;
- inFile.open("grades.txt");
- if (inFile.fail()) {
- cerr << "unable to open file input.dat for reading" << endl;
- exit(1);
- }
- }
No. –Name-- --Quiz-- -Project- -Exam- -Lab- -Total- Grade
--- ----------- -------- ---------- ------ ----- ------- -----
1. Smith 90.55 94.44 85.00 94.86 91.41 A-
2. Jones 77.50 82.04 67.00 89.57 78.88 C+
.
.
.
--- ----------- -------- ---------- ------ ----- ------- -----
Avg: ?