infinite output loop if non integer entered. :(
cant for the life of me think of why my validation goes in to an infinite output loop when non integers are entered.
part of my main function:
1 2 3 4
|
do {
cout << endl << endl << "Enter the number of days in the month (between 27 and 37): ";
cin >> numDays;
} while (isNotValidNum(numDays));
|
this is the called function:
1 2 3 4 5 6 7 8 9
|
bool isNotValidNum(int daynum) {
if ((daynum < 27) || (daynum > 37)) {
cout << endl <<"Number-of-days value out of range, please try again.";
return true;
}
else {
return false;
}//end else
}//end isValidDay
|
Topic archived. No new replies allowed.