Write, compile, and execute a C++ program based on the following considerations:
ID: 3646820 • Letter: W
Question
Write, compile, and execute a C++ program based on the following considerations: It should ask how many students test scores you want to process. Using for looping structure, input that number of test scores from the keyboard (Must enter at least 6 test scores). Find the letter grade for each test score of a student based on the following conditions:>=90
A
>=80 AND <90
B
>=70 AND <80
C
>=60 AND <70
0
<60
F
Outside the loop, the program should also count and display number of A's, B's, C's, D's, F's, average of all the
entered scores, minimum and largest of all the scores.
Explanation / Answer
following code is bit long but it will clear each and every thing to you. " # include # include # include using namespace std; struct studentType { string firstname; string lastname; double midterm; double final; double homework[5]; double hmavg; double average; char grade; }; int arraySize(); void copyFromFileToArray (studentType *s, int n); void displayData (studentType *s, int n); void homeworkAverage(studentType *s, int n); void averageAll (studentType *s, int n); void grade (studentType *s, int n); void arrangeAlphabetically(studentType *s, int n); void arrangeByGrades(studentType *s, int n); int main() { int n = arraySize(); studentType *s = NULL; s = new studentType[n]; copyFromFileToArray(s, n); homeworkAverage(s, n); averageAll(s, n); grade(s, n); cout > fn; inFile >> ln; inFile >> m; inFile >> f; for (int j=0; j> h[j]; size++; } inFile.close(); return (size-1); } void copyFromFileToArray(studentType *s, int n) { ifstream inFile; inFile.open("grades.txt"); for(int i=0; i> s[i].firstname; inFile >> s[i].lastname; inFile >> s[i].midterm; inFile >> s[i].final; for (int j=0; j> s[i].homework[j]; } inFile.close(); } void homeworkAverage(studentType *s, int n) { double max, hmSum; int indexMax; for(int k=0; kRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.