所以在我的代码中,如果你低估或高估了,你必须猜测一个数字。如何让 while 循环循环回输入,以便您可以输入另一个数字?
#include <stdio.h>
int main(int argc, const char * argv[])
{
int number = 45;
printf("Please insert a number");
scanf("%d", &number);
if (number == 45){
printf("good job! You got the number right.");
return 0;
}
else if (number < 45){
while (number < 45 || number > 45){
printf("Your number is too low");
return 1;
}
}
else if (number > 45){
printf("Your number is too high!");
return 1;
}
}