String Manipulation

The function header looks as follows:
void createTwoParts(string senP, string & p1, string & p2)

The function receives a string of characters, indicated by senP in the function header. The function has to
• replace all occurrences of the substring "Harry's" in the string with "his" and
• then split the string into two halves, indicated by p1 and p2, respectively, in the function header.

Example: If the string
"Harry walks home and sees Harry's dog and Harry's cat"
is given, the following values should be assigned to p1 and p2, respectively:
Harry walks home and s
ees his dog and his cat

If the changed string is of odd length, p2 should contain one character more than p1.
You should write down ONLY the body of the function.
Good luck with your homework.
Topic archived. No new replies allowed.