Write a recursive C++ function, called PrintRevNums, that reads a positive integer number from the keyboard in each call to the function, until a 0 value is entered (base case). In each call the function keeps a running total of the numbers being entered and the current maximum value. After a 0 value is entered, the function outputs the numbers entered in reverse order; such that, each printed number in reverse order has to be followed by a running total of the numbers in reverse order too. At the end, the function should print out the maximum value entered. For example, an input and output dialog might be the following:
Enter any sequence of positive numbers, then enter 0 to end: 45 67 32 12 0
12 Total: 156
32 Total: 144
67 Total: 112
45 Total: 45
The maximum value is: 67
The PrintRevNums has the following header definition:
void PrintRevNums(int sum);
Vocareum Automatic Grading
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here