A+B问题#acm刷题

A + B Problem

hdu-1000
问题:
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
Sample Input
1 1
Sample Output
2

问题简述:
计算A+B,并输出结果。
问题分析:
当有输入时,就计算A+B,否则跳出循环。
AC的c++程序代码:

#include <iostream>
using namespace std;
int main()
{
	int a, b, c;
	while (cin >> a >> b)
	{
		c = a + b;
		cout << c << endl;
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43316754/article/details/84886563