I'm trying to make a program where if more values were added then initially declared in then I want to make it the case that the last value is ignored.
So I have my input coming in from a data file.
Within the first line of the input it will declare the points per assignment as well as the amount of assignments.
The -1 represents a sentinel.
So in this case there are 8 assignments and the total possible points are 100.
So the next line would state the score a student received on the assignments.
Student A recived a %100.
But we might have a case like Student B:
Student scored 150/100. This cannot be allowed.
so I'm thinking I make a counter for the first line feed like so:
while (total_points != -1) // While the total points are not 1 then add up all the assignment points within the data set
sum = sum + total_points;
cin >> total_points;
and then something like this:
cin >> first_letter; // Read the first value from the new line
cin >> first_number >> second_number >> second_letter;
cin >> student_points;
student_sum = 0.0;
But then I'm a little confused.
Should I implement a if statement within the second while loop?
if (student_assignment > assignment_count)
then ignore the last value in student count, or whatever extra values there are.
How can I implement that if statement within my second while loop?