1. Get students ID (1-10) and their test score (0-100) for 10 students using two dimensional array. This should be in a function call GetInput.
2. Create a function that calculate the average of class and print.
3. The last item in the array should store sum and average.
int student_record, student_record should have sum and student_record should have average.
4. Make sure you print out all student's ID and score in nice formatted text. And, print the average at the bottom.
ignoring the function get input and stuff, i want to know how i will get the sum of the student score in
I wanted to avoid doing the assignment for you, but I can't explain it without an example
To loop through a 2D array you do exactly what you do to loop through a 1D array. Since the column of the grades is always the same you only need to change the index for the row
1 2 3
for(int i = 0; i < students; ++i)
total += array[i];
As you can see, at each cycle you will be adding value array, array, array, etc... to the total of the grades
The array is 2D but you don't iterate in two dimensions. TO do that you would do something like
1 2 3 4
for(int i = 0; i < rows; ++i)
for(int j = 0; j < columns; ++j)
something += array[i][j];