November 5th, 2007, 02:53 PM
I am trying to write a recursive function that has two inputs, first and second, which both are strings(from ). The function should print all rearrangements of letters in first, followed by second. For example, if first is the string “CAT” and second is the string “MAN”, then the function would print the strings TACMAN, ATCMAN, CTAMAN, TCAMAN, ACTMAN, and CATMAN.
And the stopping case of the function occurs when the length of first has zero characters. There are two string members are useful in the program. The following is the precondition and postcondition of these two string functions.
postcondition: The specified number of copies of c have been inserted into the string at the indicated position.
void string::instert(size_typr position, size_type number_of_copies, char c);
-Existing characters that used to be at or after the given position have been shifted right one spot.
postcondition: n characters have been removed from the string, beginning at the specified position.
void string::erase(size_type position, size_type n);
Any ideas how to do this? Thanks for the help.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!