nested for looping in c++
<p>what i did before writing the following function is that i alloted numbers 1 to 52 to a deck of 52 cards(in a 2d array with four rows and 13 columns).now i want to print the cards holding numbers (in ascending order) in a way that there are 2 displays in a line...   </p>

<pre><code>void DeckOfCards::deal()  
{  
   // initialize suit array  
   static const char *suit[ 4 ] =   
      { "Hearts", "Diamonds", "Clubs", "Spades" };  

   // initialize face array  
   static const char *face[ 13 ] =   
      { "Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven",     
      "Eight", "Nine", "Ten", "Jack", "Queen", "King" };  

   // for each of the 52 cards  
   for ( int card = 1; card &lt;= 52; card++ )  
   {
      // loop through rows of deck  
      for ( int row = 0; row &lt;= 3; row++ )  
      {
         // loop through columns of deck for current row  
         for ( int column = 0; column &lt;= 12; column++ )  
         {  
            // if slot contains current card, display card  
            if ( deck[ row ][ column ] == card )   
            {  
               cout &lt;&lt; setw( 5 ) &lt;&lt; right &lt;&lt; face[ column ]   
                  &lt;&lt; " of " &lt;&lt; setw( 8 ) &lt;&lt; left &lt;&lt; suit[ row ]  
                  &lt;&lt; ( card % 2 == 0 ? '\n' : '\t' );  
            } // end if  
         } // end innermost for  
      } // end inner for  
   } // end outer for  
} // end function deal   
</code></pre>

<p>but if i change the order of for statemants such that row comes first then column and then card...what i get is a completely different layout of the output....i.e. no two outputs in a single line....it is something completely disordered...why plz tell me?</p>
