Count and add P71649


Statement
 

pdf   zip   main.cc

thehtml

Write a procedure

void count_and_add(int& num, int& sum);

to read a sequence of integer numbers until its end, and store in num how many numbers it has, and store in sum the sum of those numbers. For instance, if the input sequence is

10 -3 23

the values after the call must be num = 3 and sum = 30.

Observation You only need to submit the required procedure; your main program will be ignored.

Information
Author
Salvador Roura
Language
English
Translator
Salvador Roura
Original language
Catalan
Other languages
Catalan
Official solutions
C++
User solutions
C++