I am having an issue where I am trying to ensure the entry is a valid numerical entry here is what I Have but I am confused if I cause a flag flip how do I reset it when valid entry is inputted so I can leave the loop?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
{
cout << "\n\nEnter total count of items being shipped";
cout << "\n\nEnter the total count here: ";
if (!(cin >> itemCount));
{
//display error message
flag = 1;
cout << "\n\nI am sorry but only whole integers are allowed as input.";
cin.clear();
system("PAUSE");
cin.ignore(MAX_READ, '\n');
system("CLS");
}//end if
} while (flag == 1);