题目:
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<algorithm>
#include<iostream>
using namespace std;
int main() {
int a;
int b;
while (cin >> a >> b) {
cout << a + b << endl;
}
return 0;
}
其中Process to end of file的意思是直到文件结束,该程序结束。即用一个循环。