Hi,
I have created this code that makes an 10x10 array grid and fills it with random numbers from 1 to 99. I also add up every row numbers together and see what row has the highest sum.
To not get lost about rows and columns, it might help you to rename "i" to "row" , "j" to "col". Similarly, avoid using 10 everywhere and instead change it to variables to show row and column sizes. This way, you can change your matrix dimensions in one place.
Here is some code to track sum of rows, but it's still missing logic for the highest one. I'll leave that to you.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int rowsize = 10;
int colsize = 10;
int Array[rowsize][colsize];
int value;
int rowsum;
int highest_rowsum; // Figure out where to insert logic to track the *highest* sum
for (int row=0; row<rowsize; ++row)
{
rowsum = 0;
for (int col=0; col<colsize; ++col)
{
value = rand() % 100 + 1;
Array[row][col] = value;
rowsum += value;
}
}
@Duthomhas -- he wants highest row sum, not highest individual cell value.