c++ - How to keep looping until non-integer is entered -


i have program trying keep looping until entered non-integer. no matter if enter non-integer or integer program still breaks , end. please help

int data; {     cout<<"enter data: ";     cin>>data;     cout<<"yes"<<endl;     return data; } while(cin.good()); 

remove return (or write after while) break code before while line...


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -