0
Guys in cpp I create a program has variable x and this program ask for the user input to give the value of x like this program :
int x; cin>> x; How can I make the user to re -input the value of x with cleaning the first input without writing cin twice
2 RĂ©ponses
+ 1
Use loops
0
I usually do it with a loop
int a = 0;
int x;
while ( a == 0){
cin>>x;
a++;
}
Don't know what this achieves though :p