Two Dimensional Arrays

2. Table of Student Grades


Answer:

Yes

Table of Student Grades

Annotation 2020-03-26 204636Imagine a class of 7 students that have a quiz every week for 5 weeks. The instructor records the grades in a table. A particular cell of the table is designated by student number and week number. For example:

      • The grade for student 0 week 1 is 42
      • The grade for student 3 week 4 is 93
      • The grade for student 6 week 2 is 78

To specifying a cell use row and column indexes like this:

gradeTable[ row ][ col ]

As with one dimensional arrays, indices start at zero. For example:

      • gradeTable[ 0 ][ 1 ] is 42
      • gradeTable[ 3 ][ 4 ] is 93
      • gradeTable[ 6 ][ 2 ] is 78

Question 2:

What is:

gradeTable[ 0 ][ 0 ]
gradeTable[ 1 ][ 1 ]
gradeTable[ 3 ][ 4 ]
gradeTable[ 5 ][ 2 ]