arrays and nested for loops

Hello everyone,

I was wondering how I should approach this problem.

The directions are to write a set of nested for loops that go through each row of secretData, computes the sum of all the elements in that row, and saves the result to the corresponding row of sumOfSecretData.

secretData is an 18-row by 62-column array of integers: int secretData[18][62] sumOfSecretData is an 18-row array of integers : int sumOfSecretData[18]

What exactly is the problem? Don't you know how to write a loop? Don't you know how to access an array element? Or don't you know how to add two numbers?
You don't need to get smart with me. After all, this is a beginners forum. :P

I do know how to write a loop but my problem is understanding how the program is going to look through each row and then sum them up.
Last edited on
Summing up a row i means summing up secretData[i][0], secretData[i][1], ..., secretData[i][61].
You do that with a loop.
I agree with ccPac014 people don't write on here to get ridiculed.
Do you know what a pointer is? If not I would suggest finding a tutorial for them
It wasn't meant as ridicule, it's just that you don't need anything besides those three things to complete the task.
ok im sorry its hard to understand tone online it just seemed that you were attacking him
There's some documentation on multidimensional arrays here: http://www.cplusplus.com/doc/tutorial/arrays/
Topic archived. No new replies allowed.