the first try--OJ

Description:

Calculate a+b

Input:

Two integer a,b (0<=a,b<=10)

Output:

Output a+b

Sample Input:

1 2

Sample Output:

3
看起來很容易的對不對?但是真的沒有想到竟然過不了~
原因如下:
1.sample中“1 2”之間是空格!
2.看了別人的答案才知道要判斷輸入的數據是否到了結尾!

#include<stdio.h>
using namespace std;
int main()
{
     int a,b;
     while(scanf("%d %d",a,b)!=EOF)
    {
            printf("%d",a+b);
    }
    return 0;
}
深感不足~
2015.3.8
>
發佈了17 篇原創文章 · 獲贊 6 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章