Question: C++ - Using a static integer variable, sum, in a function called AddUp(), keep a running total of values passed by repeated calls to the
C++ - Using a static integer variable, sum, in a function called AddUp(), keep a running total of values passed by repeated calls to the function. After each call to the function, add the value passed in to sum and return and display sum in main().
Example: cin >> value; while(value != 0) { result = AddUp(value); cout << result; cin >> value; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
