Home > Back-end >  Don't understand, ask: encountered in C and C language input illegal to want how to just can re
Don't understand, ask: encountered in C and C language input illegal to want how to just can re

Time:11-09

CARDS in circulation out... Want to know the multiple methods to solve this problem!!!!!! Thank you bosses give directions

CodePudding user response:

Period of the sample code to you

 int main () {
int n;
While (1) {
Cout<& lt;" Please enter han tata layer (1-16) "& lt; Cin> n;
if (! Cin. Good () | | n<1 | | n> 16) {
Cin. The clear ();
Cin. Ignore ();
Cout<& lt;" Input error, please heavy lose!" } else {
break;
}
}
Cout<& lt;" Input the correct: "& lt;
return 0;
}

CodePudding user response:

reference 1st floor qybao response:

section of the sample code to you
 int main () {
int n;
While (1) {
Cout<& lt;" Please enter han tata layer (1-16) "& lt; Cin> n;
if (! Cin. Good () | | n<1 | | n> 16) {
Cin. The clear ();
Cin. Ignore ();
Cout<& lt;" Input error, please heavy lose!" } else {
break;
}
}
Cout<& lt;" Input the correct: "& lt;
return 0;
}

Thank you thank you, but how lost AAA only cycle again?
  • Related