I am a bit stumped as to why this happening but I am testing to see if a user's input is a whole number and if it falls within a particular number range. The code is working right, in that it asks the user to reenter their number if it doesn't match the criteria, except that when they enter in a decimal the code continues to increase the increment.
I believe that when I clear the flags, the conditional is reevaluated and the decimal number passes the else clause but I don't get why the break doesn't restart me at the beginning of the while.
Hello, when an integer is assigned a value with a decimal point it will change it into a integer value. For example
1 2
int a = 0.44
std::cout << a;
Would print 0.
So when a decimal is entered into int ExamScore it will just remove everything after the decimal point. So when this part of your code executes
1 2
if ((ExamScore >= 0) && (ExamScore <= 100))
{
it will evaluate to true and set bool GetInput; to false.