Question: Please complete the following functions. 1. Implement a recursive function called subSix that subtracts 1 from every digit of the given integer argument that is
Please complete the following functions.
1. Implement a recursive function called subSix that subtracts 1 from every digit of the given integer argument that is 6 or larger. Print the altered integer. The function declaration should look as follows: void subSix(int n); (ex. subSix(45678); prints 45567)
2. Implement a recursive function called evens that returns an integer with only the even numbers. Note this function is returning an integer, not printing. There should be no use of cout within your function. The function declaration should look as follows: int evens(int n); (ex. evens(234567); returns 246) (ex. cout << evens(56032); prints 602)
3. Implement a recursive function called firstTwo that returns the sum of the first two digits in a positive number. If there is only one digit, that digit is returned. Note this function is returning an integer, not printing. There should be no use of cout within your function. The function declaration should look as follows: int firstTwo(int n); (ex. firstTwo(8325) returns 11) (ex. cout << firstTwo(428); prints 6)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
