<分区>
Possible Duplicate:
exiting a while loop with a negative integer
我希望用户输入几个不同的数字,然后分别测试每个数字。
此外,当输入数字 0
时,我还需要 终止程序。
这是我的代码的开头:
int userInput;
printf("please enter some numbers: \n");
while ((scanf("%d", &userInput)) == 1)
{
...
}
如何在输入 0
之前一直从用户那里获取输入?