title: Was told my C program was "hard coded" and I don't understand why
body: <p>I turned in my assignment to my online C programming class and was docked huge due to the fact that my program was "hard coded, and I can't see how it would be considered "hard coded" as I ask for user input. The following was my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define IMAX 3
  #define JMAX 4
  
  int main()
  {   
      float a[IMAX][JMAX];
      float avgrow[5];
      float avgcol[5];
      int i,j;
      char c;
  
      printf ("This program will allow you to enter numbers for 3 rows and 4 columns from         left to right then filling down, and take the averages of the rows and columns and list them next to the row and under the columns. You may use decimals but only 2 will display in the results. Press enter!\n");
      scanf ("%c",&amp;c);
  
      printf("Enter 12 numbers here for your rows and columns:\n");
      for(i = 0; i &lt; IMAX; i++)
      {
          for(j = 0; j &lt; JMAX; j++)
          {
              scanf("%f",&amp;a[i][j]);
          }
      }
      for(j = 0; j &lt; JMAX; j++)
      {
          avgrow[0] = (a[0][0]+a[0][1]+a[0][2]+a[0][3])/JMAX;
          avgrow[1] = (a[1][0]+a[1][1]+a[1][2]+a[1][3])/JMAX;
          avgrow[2] = (a[2][0]+a[2][1]+a[2][2]+a[2][3])/JMAX;
      }
      for(i=0; i &lt; IMAX; i++)
      {
          avgcol[0] = (a[0][0]+a[1][0]+a[2][0])/IMAX;
          avgcol[1] = (a[0][1]+a[1][1]+a[2][1])/IMAX;
          avgcol[2] = (a[0][2]+a[1][2]+a[2][2])/IMAX;
          avgcol[3] = (a[0][3]+a[1][3]+a[2][3])/IMAX;
      }
  
      printf("  Column1         Column2         Column3         Column4         Row Average\n\n");
      printf("%8.2f\t%8.2f\t%8.2f\t%8.2f\t%8.2f\n",a[0][0],a[0][1],a[0][2],a[0][3],avgrow[0]);
      printf("%8.2f\t%8.2f\t%8.2f\t%8.2f\t%8.2f\n",a[1][0],a[1][1],a[1][2],a[1][3],avgrow[1]);
      printf("%8.2f\t%8.2f\t%8.2f\t%8.2f\t%8.2f\n",a[2][0],a[2][1],a[2][2],a[2][3],avgrow[2]);
      printf("\n");
      printf("%8.2f\t%8.2f\t%8.2f\t%8.2f\t\n",avgcol[0],avgcol[1],avgcol[2],avgcol[3]);
  
      return 0;
  }
  </code></pre>
  
  <p>All it was supposed to do was make a 2-d array with 3 rows and 4 columns, then take the average of the rows and display that next to to the row in a table. Than take the average of the columns and display them beneath the columns in the table. </p>
  
  <p>This was his comments on my assignment "Well, you got the correct answers, but when dealing with a 2-D array, you should use nested for loops. Not one for loop and then a lot of "hard coding" values into the program."</p>
  
  <p>Any help deciphering this would be appreciated as I though I was finally understanding programming until this.</p>