how to loop back if a user enters a letter instead of a number c++ -


my program identifies user has entered letter instead of number, doesn't ask user input after that. need able prompt user enter value number , create loop or check value every time make sure isn't letter/s.

this part of code check invalid character:

while (!cin.good()) { cout << "error! accept numbers! enter in number." << endl; cin.clear(); cin.ignore(numeric_limits<streamsize>::max()); } 

as simple may be... answered question: http://www.dreamincode.net/forums/topic/186890-c-excluding-letters-on-user-input/


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -