title: C++ two dimensional array
body: <p>I am having some issues with this program for school.  I am trying to utilize a two dimensional array and am getting some errors regarding "no conversion from int to int * and '>=' : 'int [5]' differs in levels of indirection from 'int'".  I can write it for one dimensional array but am having difficulty with the syntax for the two dimensional.  Can someone point me in the right direction in regards to what I may be missing?  I have commented out after the btnShow_CLick and it works correctly, it is just the btnGroup_Click where I am obviously missing something.</p>
  
  <p>Thanks to anyone that could possibly share some knowledge.</p>
  
  <pre><code>    static const int NUMROWS = 4;
      static const int NUMCOLS = 5;
      int row, col;
      Graphics^ g;
      Brush^ redBrush;
      Brush^ yellowBrush;
      Brush^ greenBrush;
      Pen^ blackPen;
  
  
  private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
               g = panel1-&gt;CreateGraphics();
               redBrush = gcnew SolidBrush(Color::Red);
               yellowBrush = gcnew SolidBrush(Color::Yellow);
               greenBrush = gcnew SolidBrush(Color::Green);
               blackPen = gcnew Pen(Color::Black);
           }
  
      private: System::Void btnShow_Click(System::Object^  sender, System::EventArgs^  e) {
  
           panel1-&gt;Refresh();
  
           for (int row = 0; row &lt; NUMROWS; row++)
           {
               for (int col = 0; col &lt; NUMCOLS; col++)
               {
                   Rectangle seat = Rectangle(75 + col * 75,40 + row *40,25,25);
                   g-&gt;DrawRectangle(blackPen, seat);
               }
           }
       }
  
  private: System::Void btnGroup_Click(System::Object^  sender, System::EventArgs^  e) {
               int score[NUMROWS][NUMCOLS] = {{45,65,11,98,66},
                                          {56,77,78,56,56},
                                          {87,71,78,90,78},
                                          {76,75,72,79,83}};
  
           int mean;
           int student;
           mean = CalcMean(score[]);
           txtMean-&gt;Text = mean.ToString();
  
           for (int row = 0; row &lt; NUMROWS; row++)
           {
               for (int col = 0; col &lt; NUMCOLS; col++)
               {
                   student = (row*NUMCOLS) + (col);
                   Rectangle seat = Rectangle(75 + col * 75,40 + (row * 40),25,25);
                   if (score[student] &gt;= 80
                       g-&gt;FillRectangle(greenBrush, seat);
                   else if (score[student] &gt;= mean)
                       g-&gt;FillRectangle(yellowBrush, seat);
                   else 
                       g-&gt;FillRectangle(yellowBrush, seat);
                   g-&gt;DrawRectangle(blackPen, seat);
               }
           }
       }
  
       private: double CalcMean(int score[])
       {
           int sum = 0;
           int students = NUMROWS * NUMCOLS;
           for (int i=0; i&lt; students; i++) sum += score[i];
           return sum / students;
       }
  </code></pre>