Question: C++ program Write a recursive function that displays a string in reverse on the console. Use the following function header: void reverseDisplay(const string&s) For example,
Write a recursive function that displays a string in reverse on the console. Use the following function header: void reverseDisplay(const string&s) For example, (reverseDisplay("abcd") displays deba From main, test the function inside a loop that repeatedly prompts the user to enter a string and displays its reversal. In your solution, utilize the built-in string methods length) and substr( ). The length method will allow you to determine the length of the string so that you can detect the base case of the recursion. The substr ) method can be used to break the string into separate parts so that you may eventually reach the base case
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
