WAP a C++ program using Structures to calculate the total and average of scores of a selected student. The program should prompt the student to input the stu_id. This stu_id is checked against the stu-ids’ and make sure it really exists. Calculate the total and average, if the scores in assignment1 (out of 10 marks), assignment2 (out of 10 marks), mid-term score (out of 30 marks), and final score (out of 50 marks) are given.
This stu_id is checked against the stu-ids’ and make sure it really exists.
1 2 3 4 5
map <int, Student> mapStudent;
mapStudent[1] = Student(1, "Brad Pit", 0);
...
mapStudent[6] = Student(6, "Fox Megan", 0); // huuu, she has the id six... ^^
1 2 3 4 5 6 7 8 9 10 11 12 13
// ASSERTS
map <int, Student>::iterator it = mapStudent.find (stdnt.iID);
if (it == mapStudent.end())
throw"Student ID not found!"if (it->second.strName != stdnt.strName)
throw"Student ID found, but Name is wrong!"if (stdnt.iScore < 0 && stdnt.iScore > 10)
throw"Score is not in range!"
Calculate the total and average, if the scores in assignment1 (out of 10 marks), assignment2 (out of 10 marks), mid-term score (out of 30 marks), and final score (out of 50 marks) are given.