Printing an Array in rows and columns( one dimensional array)
<p>I need to print an int array that has 50 values the array must contain multiple rows and each row can't have any more than 15 variables on it. Can any one point me in the right direction or explain where I'm going wrong? </p>

<pre><code>#include &lt;iostream&gt;
using namespace std; 
int main() 
{ 
   int alhpa[51]; 

      for(int i = 0; i &lt; 51; i++)
      {
         alpha[i] = -1; // initializes all elements to -1
      }


      for(int i = 0; i &lt; 51; i++)
         { 
            for(int j = 0; j &lt; 15; j++)
               { 
                  cout &lt;&lt; alpha[j] &lt;&lt; "\t";
               }  
            cout &lt;&lt; endl;
         }


   return 0;
}
</code></pre>

<p>So the above code works it just doesn't do what I intended it to, if you run this you'll see that the array is printed in rows and each row does have 15 variables on it. How ever the issue is that it only prints the first 15 elements in the array and each time the main loop executes the process is reset and as I said above the only output is the first 15 variables over and over again.</p>

<p>I need to figure out how to print this array out in the same way it's printing now but I need all the elements in the array to be processed and printed. </p>

<p>I know that the last line wouldn't have 15 on it because there should only be room for 5 because 15 * 3 = 45</p>

<p>Any help would be awesome! </p>