A c++ program uses a two dimensional array defined as follows:
Const Int NUM_ROWS =40
const Int NUM_ROWS = 10;
int grades[NUM_ROWS][NUM_COLS];
*Write code that sums each row in the array and then displays the results.
*Write code that sums each column in the array and then displays the results.
This is going to be on my final and I got pretty lost on it when it was on our test. I did something like this for both:
1 2 3 4 5 6 7 8 9
#include <iostream>
Using namespace std;
Int main ()
Int sum =0;
For (i=0;i <NUM_ROWS;I++)
{
grades [NUM_ROWS] += sum;
}
One way to answer these questions is to write code for a complete example. Compile and run it. Then verify that the output matches what you get when you do the calculation by hand. You'll learn more, and remember better, by actually doing.
Once you've done that you can write and test the code as required by the original question.
I'd suggest for ease of testing, there's no need to use the original 40x10, start with something smaller that is easier to both write the code for and to check,