Hmm, this problem keep wondering me. I wanted to use the if else statement to loop my IC a.k.a Identification Card number. If I declare my IC as integer, then what should i type in the if else statement? if the ic is not in integer form, it will ask to key in again.
I think what you might be asking how to get input via cin and ask the user to try again the user typed something which was not an integer.
Perhaps something like this:
1 2 3 4 5 6 7 8
int ic;
cout << "Please enter Identification Card number: ";
while (!(cin >> ic) ) // get the input and check it was ok
{
cin.clear(); // reset flags
cin.ignore(1000, '\n'); // empty input buffer
cout << "Not an integer, please try again: ";
}