A + B Problem解析
题目
Calculate A + B.
Time limit | Memory limit | OS |
---|---|---|
1000 ms | 32768 kB | Windows |
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 | output |
---|---|
1 1 | 2 |
问题链接:HDU - 1000
问题描述
计算A+B的值并输出,可输入多行数据。
问题分析
利用一个while来循环程序,然后获得a和b的值,并输出a和b的和。
AC通过的C++语言程序代码如下:
#include<iostream>
using namespace std;
int main()
{
int a, b;
while (cin >> a >> b)
cout << a + b << endl;
}