List all possible combinations of x numbers taken y at a time , in C++
Posted on 2008-06-16
Is there a function or a library which has a function for this problem : I have x numbers (e.g 5) , and I want to list all possible combinations in of these numbers taken y (e.g 3) at a time. For example, let's say we have these 5 numbers: 1, 3, 5, 6, 7 , I want to print all the possible combinations taken 3 at time, which means 135, 356,567 etc etc.
If there is not such function, can you provide me the basic guidelines to build such a function? thanks a lot.