Hi guys. I'm sure this is pretty simple, but I'm stumped for a way to do this. Essentially if I have an array with P collumns and V^P rows, how can I fill in all the combinations, that is, essentially, all possible numbers in base V of P digits. For example, for P=3 and V=2
000
001
010
011
100
101
110
111
Keep in mind that this is an 2 dimensional array, not an array of ints.
For P=4 and V=3.
0000
0001
0002
0010
0011
0012
....
Having this array generated, the rest of work for what I'm trying to devolop is trivial. So having some code/tips on how to do this would be greatly appreciated. Thanks.
The outer loop increases the level from 0 to P
The inner loop increases the number form 0 to V
The most inner loop repeats the number from the inner loop level * V + 1 and sets the value according to the level in the array
:D It's the second time today I have been recommended to use std::vector. Unfortunately, this assignement is due in few hours, and I don't really have much time to look into it. Thanks though.
I don't know how to work with std::vector. All I needed was to fill in the array with the pattern in the OP. If that cannot be achieved without vectors I think I will have to find another way to do it.