Dear Users,
I need to test all possibilities in a specific code.
I couldn´t realize how I can generate theese possibilities with two
for´s.
Here is the problem:
Suppose you have a vector like
int vect[6]={0};
How could be a C code to have (print for example) all possible
combinations in the
six positions from the range 0 to 10?
the output is something like:
0 , 0, 0, 0, 0, 0
1 , 0, 0, 0, 0, 0
2 , 0, 0, 0, 0, 0
...
10, 0, 0, 0, 0, 0
0 , 1, 0, 0, 0, 0
0 , 2, 0, 0, 0, 0
...
0 ,10, 0, 0, 0, 0
1, 1, 0, 0, 0, 0
2, 1, 0, 0, 0, 0
...
10, 1, 0, 0, 0, 0
1 , 2, 0, 0, 0, 0
2 , 2, 0, 0, 0, 0
...
10, 2, 0, 0, 0, 0
...
...
10,10,10,10,10,10
Some repetition values are allowed, that is, if you have to
reset all values to begin the counting to another digit, etc.
Regards
Andre
|