# C++: Input/Output for Pairs of Numbers

From lines of input starting with a line containing the numbers of pairs to follows, followed by that number of pairs of integers separated by a space on separate lines from STDIN, output the sum of each pair to STDOUT.

Sample input with corresponding output

Input

```5
1 2
10 20
-3 5
100 2
5 5```

Output

```3
30
2
102
10```

Modified in order to take in all inputs and then give the output, the original gave the output for each pair immediately.

```/*Modified by Abhishek Ghosh, 19th March 2014, Rotterdam*/
#include <iostream>
using namespace std;

int doStuff(int a, int b) {
return a + b;
}

int main() {

int t, **list;

cin >> t;

list = new int*[t];

for(int j=0; j<t; j++){

list[j] = new int[2];
cin >> list[j][0]>> list[j][1];

}

cout << endl;

for(int j=0;j<t;j++){
cout << doStuff(list[j][0], list[j][1]) << endl;;
}
return 0;
}
```

Run as per given input

```5
1 2
10 20
-3 5
100 2
5 5

3
30
2
102
10```

SOURCE

Content is available under GNU Free Documentation License 1.2.