I'm doing a Banking System project and need to make sure that every input is valid(program has to be robust). If invalid input is given then user has to enter again.
But when i have a variable of int
type and user enters char
type an infinite loop begins.
For example:
int i;
cin>>i;
If user enters a char
infinite loop starts. How can i avoid it and ask user for an input again?
Thanks