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
問題鏈接(https://vjudge.net/problem/hdu-1000?tdsourcetag=s_pctim_aiomsg)
問題簡(jiǎn)述:實(shí)現(xiàn)簡(jiǎn)單的加法運(yùn)算,對(duì)輸入的A痊班,B值進(jìn)行加法計(jì)算并輸出結(jié)果
程序分析:由于題目要求對(duì)多行數(shù)據(jù)進(jìn)行計(jì)算摹量,所以循環(huán)體的條件為cin>>a>>b馒胆;即當(dāng)輸入Ctrl+z時(shí)停止程序祝迂;
AC的C++代碼如下
#include<iostream>
using namespace std;
int main()
{
int a,b;
while (cin >> a >> b)
{
cout<< a + b << endl;
}
return 0;
}