Assignment 4
Write a program that calculates the semester grades of students. The program first reads the number of students, and then reads 6 scores for each student. Each score is an integer, and ranges between 0 and 10. Assume that there are at most 10 students. The program outputs the semester grades of students and the number of the most difficult quiz.
The semester grade of a student is the average of the 4 highest scores.
The number of quiz begins from 1. That is, the quiz numbers are: 1, 2, 3, 4, 5, 6. The most difficult quiz is the one that produces the smallest sum of student scores.
If there are two quizzes of the same difficulty, then report the one with the smaller quiz number.
Program Input
Enter the number of students: 3
Enter the scores for each student:
4 1 10 6 1 10
9 2 6 3 8 9
5 0 3 1 7 3
Program Output
Table of Semester Grades:
Stud1 Stud2 Stud3
Grades: 7.5 8.0 4.5
The number 2 quiz is the most difficult one.
Your solution should be based on the code template .
Your program must conform the following requirements:
The outputs of your program should behave as in the above example.
You only need to add your code to the function definitions of computeSemesterGrades() and displayHardQuiz()
Add your code according to the comments in the function definition.
Do not modify readStudentGrades() and displaySemesterGrades()
Do not modify main() unless you know what you are doing.
Do not modify any cin or cout statements, and do not add any cout statements. Otherwise, your program might not be evaluated properly.
More input-output samples.
Hint:
You can use sort(array, array+5) to sort an array with size 5.