call to function summing two integers X70594


Statement
 

pdf   zip   tar

html

Write a program that reads pairs of integers and writes the sum of each pair. Use a provided function to carry out that task.

In the provided public files you’ll find a file called sum.hh which contains the following function declaration:

int sum(int a, int b);

There is also a file sum.cc with its implementation. There is also a Makefile, so that you can compile and test everything on your own. For that, you have to implment a file called main.cpp which will have to make use of function sum in order to meet the target of this exercise. For the submission part to jutge.org, you’ll have to submit a tar file generated as follows:

tar cf solution.tar main.cpp

Input

The input contains several lines, with a pair of integers per line.

Output

For each pair of integers, write their sum in one line.

Public test cases
  • Input

    3 4
    -3 1
    3 -2
    6 10

    Output

    7
    -2
    1
    16
    
  • Input

    -18 -18
    4 -38
    2 6
    -42 -20
    -6 44
    -6 -11
    15 -31
    1 41
    -49 -45
    39 -16
    -25 8
    -30 1
    -12 15
    -20 -43
    -30 -40
    1 -32
    -7 21
    47 11
    -24 -45
    7 20
    

    Output

    -36
    -34
    8
    -62
    38
    -17
    -16
    42
    -94
    23
    -17
    -29
    3
    -63
    -70
    -31
    14
    58
    -69
    27
    
  • Information
    Author
    Guillem Godoy
    Language
    English
    Other languages
    Catalan
    Official solutions
    Make
    User solutions
    Make