cplusplus.com
C++ : Forum : Beginners : Adding two multi dimensional arrays toge
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


post Adding two multi dimensional arrays together

iamthefear (20)
Hi guys

I am confused on how to do what the title says, I need to add together the contents of the two multi dimensional arrays, I really have no idea how to do this; so at the moment do not have any code; could someone give me an idea on how to do this, thanks.
anilpanicker (102)
1
2
3
4
5
6
7
8
9
10
11
12
13
int father[5][5];
int mother[5][5];
int son[5][5];
for(int i=0;i<5;i++)
{
	for(int j=0;j<5;j++)
	{
		father[i][j]=5;
		mother[i][j]=6;
		son[i][j]=father[i][j]+mother[i][j]; // son is the sum of
	}

}
Last edited on
iamthefear (20)
thanks anilpanicker, very helpful :) Will use it for reference. Thanks
Topic archived. No new replies allowed.