Question: Recursive string reverse function. (Note: if you have to change this main function to get the output tests to work, then the unit tests will

Recursive string reverse function.

(Note: if you have to change this main function to get the output tests to work, then the unit tests will most likely not work.)

Implement the following global function using a recursive algorithm to reverse the contents of a string passed in by reference. 
void flipString(string &s); 

You may not use a loop of any kind. You may not use global variables. You may not use the word reverse anywhere within your main.cpp file.

int main() { string line; cout << "Enter a sentence:" << endl; getline(cin, line); cout << endl; cout << line << endl; flipString(line); cout << line << endl; return 0; } 

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!