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

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

qt - Change color of QGraphicsView rubber band -

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -