Question: 4. Write a function for c++ that accepts a word as an input argument (type string) and generates several different scrambles of the word. (Output

4. Write a function for c++ that accepts a word as an input argument (type string) and generates several different scrambles of the word. (Output to the screen.) The input word can be from 4 to 10 letters in length. The number of scrambles produced depends on the number of letters in the word. e.g. the 4 letter word lose would have 4 different scrambles produced and the seven letter word edition would have seven different scrambles.

Here is a candidate example: Input: FLOOR

Possible Scrambles: ROOLF, OOLFR, OLFRO, LOORF, OORFL

Your function must use the same block of code for each input word. (That is you cannot test for the word length and then have special code depending on the result.) You have a number of tools available to assist with this including the reverse string operation you did in homework three. There is also the rand() random number generator available. Come up with your own algorithm for this problem. PLEASE DO NOT USE VECTOR NOTATION.

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!