输入说明:
Your program will be tested on one or more test cases. Each test case is made of a single positive number (0 < n0 < 1, 000, 000).
The last line of the input file has a single zero (which is not part of the test cases.)
我刚刚输入了这样的代码:
int main()
{
int n0;
while((scanf("%d", &n0)) != 0)
{
..........
}
但是为什么输入 0 仍然被处理呢?
最佳答案
while (1) {
scanf("%d", &n0);
if (n0==0) break;
...
}
关于c - 这段代码如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16615349/