permutation program

Hi readers, if someone could pass me in the right direction on how to accomplish this please don't reply a search engine lol......

What is needed is to have option to enter string of text and numbers.
then do a permutation on that string x amount of times
display the output!
I don't understand what you mean by permutation in this case. What exactly needs to be done?
if i were to ask a user for input (123456789)
then the program does a permutation on those numbers
outputting the answers
to clarify, if your user inputs say, "123", your program should output:
123, 132, 213, 231, 312, 321

Is this what you mean?
yes i am a novice at C++ hence the reason im asking where to start
The problem is less C++ and more what algorithm to use.

Try this perhaps?

You might also find helpful:

Otherwise just google "permutation algorithm" and find one you like :)

Likely what you'll need is some kind of nested for loop that swaps the elements around in the string. Just remember to be aware of redundant permutations.
Last edited on
thankyou i will ponder on this for now
Topic archived. No new replies allowed.