I know what I need to do in this program, I just don't know how to do it.
This program needs to show the the average of grades after the user decides what quiz to drop. Except I don't know how to do that. I tried sum_points_possible += points_possible_array[i - quiz_to_drop] and it came out with infinity. I would love any help. Thanks:)
Please post a sample of your input file. And also provide a sample of what you input into the program and what output you expect the program to produce.
Please enter the data asked below in the input file.
The end of the data is indicated by a negative quiz number and 0s for the other two data values on the line.
Quiz number Maximum points on the quiz Points earned
Please enter the quiz number you want to drop. 4
0x28aae00x28aae00x28aae00x28aae00x28aae0Quiz number Maximum points on the quiz Points earned
0 20 20
1 20 20
2 20 20
3 20 20
4 20 20
The average grade is inf
cout << points_earned_array; Was used to see if what was going wrong with the program. I was going to delete it after I fixed the program.
dropped_quiz_avg = (( sum_points_earned)/(sum_points_possible) * 100);
this is the confusing part because the quizzes can be vary in max points possible. That's why I added all of the points earned and divided it by points possible. I don't understand how I can subtract the quiz the user wants to drop from the over all total.
That is not how you compute an average! You compute an average by adding all the points earned and then dividing that sum by the number of quizzes . The number of possible points is not relevant to the average of quizzes. If you are going to throw out a score you either don't add that score to your total scores or you subtract that score from the total. Then you divide by the number of quizzes - 1 to get your average.
I changed everything like you said and the new output is:
Please enter the data asked below in the input file.
The end of the data is indicated by a negative quiz number and 0s for the other two data values on the line.
Quiz number Maximum points on the quiz Points earned
Please enter the quiz number you want to drop.4
Quiz number Maximum points on the quiz Points earned
0 20 20
1 20 20
2 20 20
3 20 20
4 20 20
The average grade is -5000
Look at your calculation: dropped_quiz_avg = (( sum_points_earned)/(quiz_number - 1) * 100);
First are you trying to compute the average of the dropped score?
Or the average of the scores?
Where have you assigned any value to quiz_number?
Where have you subtracted the quiz you want to drop from the total?
Why are you dividing by 100?
You may want to turn off your computer, take pencil and paper and compute the average by hand. If you don't know how to do the math you will probably never be able to finish this program.