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,

C++ program  C++ program Write a recursive function that displays a string in

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!