c语言 请教
int get_int(void)
{
int input;
char ch;
{
int input;
char ch;
while ((scanf_s("%d", &input)) != 1)
{
while ((ch = getchar()) != '\n') /*当scanf的返回值不为1时,ch是自动获取输入的input???*/
putchar(ch);
printf(" is not an inter.\n"); /*putchar输出的字符与printf输出的字符不换行????*/
printf("please enter an integer value: ");
}
return input;
}
{
while ((ch = getchar()) != '\n') /*当scanf的返回值不为1时,ch是自动获取输入的input???*/
putchar(ch);
printf(" is not an inter.\n"); /*putchar输出的字符与printf输出的字符不换行????*/
printf("please enter an integer value: ");
}
return input;
}
请问大家第二个嵌套的while怎么理解?是我理解的那样吗?
#笔试题目#