回复 7楼 yctchxf
嗯,是的,不过在多个输入结束时还是要用到EOF,我也不知道为什么。
Eg :
Input:
1 2
2 3
3 4
EOF
就会Output:
3
5
7
此外,还有一个问题,就是系统提示,下面这个经过修改的程序,有下面这个问题,能帮忙解释一下吗?
#include <stdio.h>
int main()
{
int a,b,c[1000];
int i=0;
while(scanf("%d%d",&a,&b) != 0)
{
c[i]=a+b;
i++;
}
for(int j=0;j<i;j++)
printf("%d\n",c[j]);
return 0;
}
SIGSEGV --- Segment Fault. The possible cases of your encountering this error are:
1.buffer overflow --- usually caused by a pointer reference out of range.
2.stack overflow --- please keep in mind that the default stack size is 8192K(Notice: In GCC a little overflow will not get a Runtime Error).
3.illegal file access --- file operations are forbidden on our judge system.