I started with a code to calculate the final grade of the students asking for input information, such as midterm, final, homework, presentations and more grades. That piece of code works but exits after sending the final grade for one student and I'd like the programme to ask if the user wishes to input data for another student, so I tried to implement the do-while loop but the programme prints the last question and exits.
I am posting here a shorter and simpler version. I tried with a factorial calculator and the do-while loop does the work, but for the code below doesn't work. If I comment part of the code and change variables for constant data, the question appears and I have the option to select yes or no, but the whole code doesn't allow me to reply to the question.
Do I need a specific library for this action, particularly working with vectors?
Yes, I didn't explain that :P I am simply typing end-of-file command (ctrl+z). I don't specify it in this code 'cos it is only me trying to make this piece of code work, specifically for the do-while loop.
In another file I have a longer code where I include a flag to indicate the end of input. Is this causing the conflict??
When you reach the end-of-file the stream becomes invalid, you simply need to restore it.
So put cin.clear(); after the loop. If still doesn't work, discard what you have in the input buffer cin.ignore();