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
题目大概意思是:每一行输入A和B输出它们的结果
我的思路:因为是每一行,所以采用while,进行循环输入输出
代码如下:
#include "pch.h"
#include"iostream"
using namespace std;
int main()
{
int a, b;
while (cin >> a >> b)
{
cout << (a + b) << endl;
}
}