Each record contains the student id and the result of 4 exams.
II. Assume that the maximum class size is 20. You are going to read the input file into an array of structure to produce two files:
1) The first file (LAST_F.I._final1.txt) will be similar to the following:
Produced by (Your Name)
ID Exam 1 Exam 2 Exam 3 Exam 4 Average Grade
76606 68 80 88 74 77 C
72049 89 95 93 97 93 A
73338 70 89 95 99 88 B
71836 57 51 65 64 59 F
75739 64 67 71 76 69 F
79281 91 91 87 97 91 B
79741 83 87 73 88 82 C
77578 94 86 54 66 75 C
74366 77 54 70 50 62 F
76166 68 95 58 68 72 F
The average is the average score of the 4 exams. Use DTCC grading system for grade where A is > 91, B is > 82, C is >74 and F is <75;
2) The second file will be the same as above except it is sorted on ID in ascending order.
Name this file (LAST_F.I._final2.txt).
III. Your main function should contain only the following statements:
int _tmain(int argc, _TCHAR* argv[])
{
totalStudent = readFile();
writeFile("LAST_FI_final1.txt", totalStudent);
sort(totalStudent);
writeFile("LAST_FI_final2.txt", totalStudent);
return 0;
}
You should also have a function called assignGrade called inside readFile();
struct student
{
int id;
int ex1;
int ex2;
int ex3;
int ex4;
int average;
char grade;
};
student studentnum[20];
int _tmain(int argc, _TCHAR* argv[])
{
//teacher said this had to be in the main I have no idea what to do with it.
totalStudent = readFile();
writeFile("LAST_FI_final1.txt", totalStudent);
sort(totalStudent);
writeFile("LAST_FI_final2.txt", totalStudent);
return 0;
}
char assigngrade(int average)
{
if (average < 75)
return 'F';
else if (average >= 75 && average < 82)
return 'C';
else if (average >= 82 && average < 91)
return 'B';
else
return 'A';
}
I am super new to programming, and I do not know a lot. Please be gentle.