let’s say , a course with 8 participans, i must output the first 3 places in all possible ways.
ex :
123
124
125
126
127
128
213
so on..
I know there is next_permutation algorithm but it returns all the possible permuations with all the numbers (from 1 through 8), but i need first 3 places with all the participans
ex:
1 2 3 4 5 6 7 8
1 2 3 4 5 6 8 7
This program produces the output you are looking for, not necessarily in the order you expect. If you want it in a particular order, you may need to capture the output and sort it. To see it run, look here.