Code:nt x; displayMainMenu(); cin >>x; while (!cin) { cin.clear(); cin.ignore(100,'\n'); displayMainMenu(); cin >>x; }
Ok, the way I have it, if I type in any string such as 12A, the number 12 will be read in to x. If it's 9.A, it will read 9. This only works if the number is in front. If I type A9, it is an error and redisplays the menu.
how do I make sure input like this is not considered good?
Thanks!


Reply With Quote


Bookmarks