Combinations

Hi Everyone i've asked before how to make combinations it helped but this time i'm trying to make an infinite combination:
a b c...
aa ab ... ba bb ... ca cb ...
aaa aab ... aba abb ... baa ...
.
.
.
and so on.
its a combination with repetition.
if you guys can explain in most simple way i'll be thankful.
Technically these are permutations, not combinations. With combinations. the order doesn't matter, so ab and ba are the same. Order matters with permutations.

There's a next_permutation() function in the standard <algorithm> include file, but since you're asking in the beginners forum, I suspect you need to write the code by yourself.

Have you learned about recursion? Permutations can be done very efficiently if you do them recursively.

Topic archived. No new replies allowed.