1.
while(scanf("%d,&n)&&n!=0)
while(scanf("%d",&n&&n)
while(scanf("%d",&n),n)
功能:当输入n且n!=0时继续循环,当n为0时结束循环(上述三种写法都可实现此种功能)
2.
while(scanf("%d,&n)!=EOF)和while(~scanf("%d",&n)
功能:当读到文件结尾时终止循环
1.
while(scanf("%d,&n)&&n!=0)
while(scanf("%d",&n&&n)
while(scanf("%d",&n),n)
功能:当输入n且n!=0时继续循环,当n为0时结束循环(上述三种写法都可实现此种功能)
2.
while(scanf("%d,&n)!=EOF)和while(~scanf("%d",&n)
功能:当读到文件结尾时终止循环