I am writing a program and am using the cin command.
I have one problem, if I specify for the program to take an integer variable and someone accidently enters a character or if I am using an array and someone enters in too many characters for the array the next time a cin statement comes up, the program skips over it and goes to the next step. This puts my program in an infinite loop and it is no longer useful. How can I remove this problem to keep from my program screwing up by simple human input error.
I have one problem, if I specify for the program to take an integer variable and someone accidently enters a character or if I am using an array and someone enters in too many characters for the array the next time a cin statement comes up, the program skips over it and goes to the next step. This puts my program in an infinite loop and it is no longer useful. How can I remove this problem to keep from my program screwing up by simple human input error.