杭电ACM 1000题

Problem Description
Calculate A + B.
Input
Each line will contain two integers A and B. Process to end of file.
 Output
For each case, output A + B in one line.
Sample Input

1 1
Sample Output

2


我的答案:

include
void main()
{
    int a,b,c;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
        c=a+b;
        printf("%d\n",c);
    }
}

我的问题在于“end of file”,直白的说,处理到文件结束,将缓存区中的东西都读出来,查了之后发现,

需要写成这样一种形式while(scanf("%d %d",&a,&b)!=EOF),,,我也不是很懂。


你可能感兴趣的:(在读学生)