C++的A+B问题

来源:百度知道 编辑:UC知道 时间:2024/05/06 13:20:59
Input:
The input will consist of a series of pairs of integers a and b,separated by a space, one pair of integers per line, 0 0 means the end of the input, and do not need to output.
Output:
For each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.
Sample Input:
1 5
0 0
Sample Output:
6

在一行输入两个整型数,换行输出结果,循环执行,直到用户中止。
0 0是用来终止输入的,不需要输出。

int main()

{

int a,b;

cin >> a >> b;

while(cin >> 0 >> 0)

cout << a+b << endl;

}