#include #include #include #include #include int howmany; int numtest; struct studentstruct { char name[15]; int grades[6]; int total; int average; }; int help(int choice) { cout<<"1: Get specific Student Record" << endl; cout<<"2: Sort students by NAME, then display" << endl; cout<<"3: Sort students by TOTAL SCORE, then display" << endl; cout<<"4: Compute average of each test and display all grades"<>choice; return choice; } void display(studentstruct student[]) { int found = 0, x = 0, i = 0; char name[15]; cout << "Name: "; cin.getline(name, 15); for (x = 0; x <= howmany; x++) { if (strcmp(student[x].name, name) == 1) { found = 1; cout << student[x].name; for (i = 0; i <= numtest; i++) { cout << " " << student[x].grades[i]; } cout< 0) { flag = 0; strcpy(temp, student[x].name); strcpy(student[x].name, student[x + 1].name); strcpy(student[x + 1].name, temp); flag = 0; } } } while (flag != 0); } void scoresort(studentstruct student[]) { int temp, q, x, flag; do { flag = 0; for (x = 0; x <= howmany; x++) { do (student[x].total > student[x + 1].total) { flag = 0; temp = student[x].total; student[x].total = student[x + 1].total; student[x + 1].total = temp; } } } while (flag != 0); } void average(studentstruct student[]) { int average; int x, q; for (q = 0; q <= howmany; q++) { cout<<"Grades for "<>howmany; infile>>numtest; studentstruct student[5]; for(i=0; i < howmany; i++) { infile>>first; infile>>last; strcat(first," "); strcat(first, last); strcpy(student[i].name, first); for(r =0; r < numtest; r++) { infile>>student[i].grades[r]; student[i].total = student[i].total + student[i].grades[r]; } } do{ choice = 0; choice = help(choice); while (choice != 5) { switch (choice) { case 1: display(student); break; case 2: namesort(student); break; case 3: scoresort(student); break; case 4: average(student); break; case 5: exit(0); break; } } } }