2d Array help? Any advice is appreciated!

How would I add the sum of the random numbers in the row, and do the same for the column? It's for a magic square program.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  int table[3][3];
int row = 3;
int col = 3;

int main()
{

	for (row = 0; row < 3; row++)
	{
		for (col = 0; col < 3; col++)
		{
			table[row][col] = rand()%9;
			cout << table[row][col] << "    ";
		}
		cout << endl;
	}

    return 0;
}
Do you know how to calculate the sum of values of a 1D array?
Topic archived. No new replies allowed.