So, I am in a intro to C++ class right now. We are learning and working with loops and this is an assignment I did. Everything is fine, but I wanted an option to run the program again so I used a do-while loop to get a yes or no on running again. The thing is, when it runs again it ignores the whole second part of the program designed to get assignment scores. The test score section is a for loop and that runs fine every time. It's the while loop that is getting skipped.
Any suggestions are welcome and well received.
I kind of thought that might be the culprit. so if i just put int assignmentGradeNumber = 1 inside the do loop everything will work out the way i want?
Okay, so I changed assignmentGradeNumber =1 to inside the do-while loop. The thing I'm encountering now is that qGradeTotal and aGradeTotal still have their values from the previous execution. Now I figure i could just define both as '0' before the loops initialize, but is there a better way to wipe out cin input at the end before it restarts? Sorry to ask so many questions, but my class is 1 4hr a week class and its execrated due to summer schedule so i don't get a lot of one on one for Q&A with the professor.
No variable (except again) are used outside the loop so you could just define them inside the loop instead. That way the variables will be initialized each time the loop (re)starts.