for and do...while looping in c++
<p>//i wrote the following code to shuffle a deck of cards (fig 8.26 deitel&amp;deitel)  </p>

<pre><code>int i,j;  
for(int x=1;x&lt;53;x++) {
   i=rand()%4;  
   j=rand()%13;  
   if(deck[i][j]=0)  
       deck[i][j]=x;
   else
       x--;
}  
</code></pre>

<p>//this didn't produce any result whereas the following code produced results  </p>

<pre><code>int i,j;  
for(int x=1;x&lt;53;x++) {
    do {
        i=rand()%4;  
        j=rand()%13;
    } while(deck[i][j]!=0);  
    deck[i][j]=x   
}  
</code></pre>

<p>//plz tell me what is the difference  </p>
