Question: C++ Help. String manipulation. Using string functions in C++, write the body of the function replace_2nd, which is intended to change the string s1 ,

C++ Help. String manipulation.

Using string functions in C++, write the body of the function replace_2nd, which is intended to change the string s1, replacing the 2nd occurrence of the string olds with the string news. You may add any statements you like but you may not change the function declaration in any way. You may not add parameters, subtract parameters, or change the type of any parameter.

C++ Help. String manipulation. Using string functions in C++, write the body

Write 3 additional test cases, similar to the ones in the main function. You should test different things than what is already there. Your tests must compile and your function replace_2nd should also pass them.

of the function replace_2nd, which is intended to change the string s1,

Could use some help mostly on the first part. I feel as the program requires string manipulation such as using erase and replace, but I am unsure how to do that, help would be nice.

Original replace olds with news Final Hello jello Hello jello lo Hello jelloe Helzo jello Hello jelp Hello jaaaallo

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!