c++ languageRecursion Handout recFun (x / 10); cout<<x 10; 1. Consider the following function: else void recursePrint(int n) cout<x; if (n != 0) // Line 1 a) What is printed by the call: recFun (268); cout<< “hipn”; //Line 2 recursePrint (n-1); 113 else b) How can the code be modified so that when a number is input, its digits are printed on separate lines? cout<< “Horray!”; // 4 a) What is the base case? c) How can the code be modified so that the sum of all digits is printed? b) What is the recursive case? 3. Use a recursive function findRecurse that returns true if an element is an array and false otherwise: c) How many times is recursePrint called if the line: recurse Print (4); is in the main program base case: The element is equal to the first item in the array; returns true. Alternatively there are no elements left in the array, returns false. 2. Consider the following recursive function (Chapter 17, 19, modified) void recFun (int x) recursive case: The element is not equal to the first item in the array. This means that we have to search the rest of the array for the item. if (x > 10) Show transcribed image text Recursion Handout recFun (x / 10); cout
Expert Answer
Answer to Recursion Handout recFun (x / 10); cout…