1.

Solve : help needed in generating all combinations of 8 numbers?

Answer»

hi everyone,

I am LOOKING for a algorithm which can generate all combinations of 8 numbers.

can anyone know how to do this.

please tell me.

thank in advance.Quote

I am looking for a algorithm which can generate all combinations of 8 numbers

Single digit numbers? Double digit numbers? Permutations? Combinations?

Wasn't an answer posted here? With a few changes and CHANGING alchemist to numbers, you should be able to find a solution.



Note: I forgot to mention in the previous POST that the C program can be compiled with the Tiny C CompilerCode: [Select]for (int i = 0; i < 100000000; i++)
cout << i << endl;
Is that what you're looking for? Another way you could do it is to nest 8 loops INSIDE of each other.

Code: [Select]for (int i1 = 0; i1 < 10; i1++) {
cout << i1;
for (int i2 = 0; i2 < 10; i2++) {
cout << i2;
for (int i3 = 0; i3 < 10; i3++) {
etc...
}
}
}
And when you get to i8, print out a new line.


Discussion

No Comment Found