How to store data in a 2D array and display the 2D using 2 loops
<p>I was trying to draw a scrabble game. You can refer to the attach image, it was my board design. My program will ask user to put the row and column and insert the words. Example : ROW =A Column =5. But i don know how to declare the variable for each. Kindly assist. Thanks.</p>

<p><a href="http://img824.imageshack.us/img824/516/capturecba.jpg" rel="nofollow">http://img824.imageshack.us/img824/516/capturecba.jpg</a></p>

<p>Below is my code:</p>

<pre><code>void displayBoard()
</code></pre>

<p>{
    int a = 0;
    static string alpha[] = {"1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9 ","10","11","12","13","14","15"," "};</p>

<pre><code>cout &lt;&lt;"   A B C D E F G H I J K L M N O P"&lt;&lt;endl;

for (int j=0; j&lt;=14; j++)
{
    cout &lt;&lt; alpha[a];
    for ( int i = 0; i &lt;= 15; i++)
    {
        cout &lt;&lt; "|_";
    }
    cout &lt;&lt;"|";
    cout &lt;&lt;endl;
    a++;
}
</code></pre>

<p>}</p>

<hr>

<p>Thanks for help. I not so understand this. </p>

<pre><code>for(i=0;i&lt;word_length;i++)
{
board[word_i_offset][word_j_offset+i]=temporary_word_input[i];
}
</code></pre>

<p>Btw, i try re-do whole and halt on the insert.</p>

<pre><code>void displayBoard()
{
 int i=15;
 int j=15;
 int a=0;
   static string alpha[] = {"1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9    ","10","11","12","13","14","15"," "};

  cout &lt;&lt;"   A B C D E F G H I J K L M N O"&lt;&lt;endl;


  char board[i][j];

for(int k=0; k&lt;j; k++)
{
    cout&lt;&lt;alpha[a];
    for(int k=0; k&lt;j; k++)
    {
       board[i][j]=' ';
       cout&lt;&lt;"|_";
    }
    cout&lt;&lt;"|";
    cout&lt;&lt;endl;
    a++;
}
cout&lt;&lt;endl;

 }

 int main()
  {
  int i=15;
  int j=15;
   int l=0;
  char board[i][j];
  int words,column;
  char answer,rows;

  displayBoard();

  cout&lt;&lt;endl;
  cout&lt;&lt;"Enter how many words : ";
  cin&gt;&gt;words;
  cout&lt;&lt;endl;
  cout&lt;&lt;"Insert on which rows : ";
  cin&gt;&gt;i;
  cout&lt;&lt;endl;
  cout&lt;&lt;"Insert on which column : ";
  cin&gt;&gt;j;
  cout&lt;&lt;endl;
  cout&lt;&lt;"Insert what words : ";
  cin&gt;&gt;answer;
  cout&lt;&lt;endl;

  for(l=0;l&lt;words;l++)
  {
  board[i][j]=answer[];
   }

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