Hi, guys~
I just want to user input a number and then decide whether continue or not, but I met a infinite loop when testing it. my code is right below:
it works fine when input a simply number, but that mess comes when your input a string like "relrejlre" etc. How to calm it down ???Code:#include <iostream> void main () { int x; while(1) { cout << "input a number: "; cin >> x; if (number==8) { break; } } //if break then go to next step; }