Hello of123,
These re the problems I found and the changes I made to get the program to work.
Based on your above code.
Line 47. These variables are backwards. Assignment is from right to left, so what you are doing here is assigning "QuizGrade" the value of "LowestQuiz" which has a value of 20. you never see his this because at this point changing "QuizGrade" has no use and you do not do anything with "QuizGrade" after this point.
Line 73. Works, but all it does is print a message and says nothing about how many Quiz Grades have been entered. Also you my need to adjust how the information is displayed.
Line 85. This will never be reached unless "NumQuizzes" is equal to zero. I changed the line to:
if (NumQuizzes)
. After some thought it should work if you remove line 85 and the {} that go with it as you really do not need it. You do need the if/else to figure the "AvgGrades". I will have to check this after while.
Lines 92 and 99. I hanged these because you are doing integer division before you type cast to a float. The number are small enough that a "float" may not be a problem, but these days "double" is the preferred type to use. I found this change to work better:
1 2 3 4 5
|
line 92:
AvgGrades = static_cast<double>(SumGrades) - static_cast<double>(LowestQuiz) / (static_cast<double>(NumQuizzes) - 1.0) * static_cast<double>(MIN_NUM_QUIZZES);
line 99:
AvgGrades = static_cast<double>(SumGrades) / static_cast<double>(NumQuizzes) * static_cast<double>(MIN_NUM_QUIZZES);
|
This seemed to work the best or you could just define these variables s "double" to start with and void the integer division.
Line 102. I changes the "setprecision" from 1 to 2.
Line 110. I changed the setw from 4 to 7 so the output would line up better.
Give it a try and see what you think,
Hope that helps,
Andy