1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include<iostream>
using namespace std;
void sum(int[][3], int[][3], int[][3]);
int main()
{
int max1[3][3] = { { 3, 4, 2 }, { 2, 6, 8 }, { 7, 3, 9 } };
int max2[3][3];
int max3[3][3];
for(int a = 0; a < 3; a++)
{
for(int b = 0; b < 3; b++)
{
cout << "Enter value:" << endl;
cin >> max2[a][b];
}
}
sum(max1, max2, max3);
cout << "Your product of addition is:" << endl;
for(int a = 0; a < 3; a++)
{
for(int b = 0; b < 3; b++)
{
cout << max3[a][b] << ' ';
}
cout << endl;
}
cin.get();
return 0;
}
void sum(int max1[][3], int max2[][3], int max3[][3])
{
for(int c = 0; c < 3; c++)
{
for(int d = 0; d < 3; d++)
{
max3[c][d] = max1[c][d] + max2[c][d];
}
}
}
|