Trying to develop a sort of permutation algorithm
<p>I want to develop the following put can't get it right.
I have a vector of N length. Each element can become 0 to K. Here N and K are given by the user. Now I'm trying to create a function in which I can walk through all possible solutions.</p>

<p>So let's say N is 4 and K = 2, then I want to loop through all possible permutations (?).</p>

<p>I want to fill a vector with 0000, test it then fill the vector with 1000, test it then 0100 etc.</p>

<p>It's important to know that 0100 and 0010 are different. As are 1100 and 0011 etc.</p>

<p>For extra notice this is what the loop should print (it really doesn't matter is 0001 or 1000 comes after 0000 etc as long as all different possible sequences come up).</p>

<p>0000, 1000, 0100, 0010, 0001, 1100, 1010, 1001, 1110, 1101, 0111, 0101, ....., 2012, 2211 etc..</p>

<p>I've tried a combination of for loops but can't really get it.
The application is in C++</p>

<p>Please help, tnx </p>
