What is an elegant way to write all possible values of an array? Let's say that the array is boolean:
bool A[3];
I'm trying to generate all possible values of this array: (0,0,0), (0,1,0), (0,0,1), (0,1,1), (1,0,0), (1,1,0), (1,0,1), (1,1,1). (Permutations with replacement, I believe)
Obviously, the number of possible values is K^n, where K is the number of possible values for each member of the array (2 for boolean, 10 for digits, etc.), and n is the length of the array. How do I make sure I cover all of them?