How can i print this 2d array?
<p>Hi i want to create a 2d array using a fuction.. the user will enter the dimensions(x,y) and the function will print it.. in the first row must appear the numbers 1,2,3...x and in the first column the caracters a,b,c,d,e....y(y is given as a number)..
for example if the user enters x=5 y=7 it wii print:</p>

<pre><code>  1 2 3 4 5 
a _ _ _ _ _
b _ _ _ _ _
c _ _ _ _ _
d _ _ _ _ _
f _ _ _ _ _
h _ _ _ _ _
i _ _ _ _ _
</code></pre>

<p>i wrote some code but i dont knoe how to do this with the letters..</p>

<pre><code>void function(int x,int y)
{ 
    char th[x][y];

    for (int i = 1; i &lt; x; i++)
    { 
       for (int j = 1; j &lt; y; j++)
       {
          if(i==1 )
          {
            for (int k = 1; k &lt; x; k++)
            {
               th[i][j]=k;
            }
          }
          else if(j==1)
          {
            th[i][j]='a';
          }
          else
          {
            th[i][j]='_';
          }
          std:: cout &lt;&lt; th[i][j] &lt;&lt;'\t';
       }

       cout &lt;&lt; std::endl;
    }  
 } 
</code></pre>

<p>Thanks in advance for your help..</p>
