We input two sets of matrices and the output is obtained simply adding the curresponding elements of the matrices. A game of simple logic.

#### Program:

//matrix

#include<iostream.h>

#include<conio.h>

class dom

{

int m,n,i,j,a[3][3],b[3][3],c[3][3];

public:

void get();

void check();

void disp();

};

void dom::get()

{

cout<<"enter the order of matrix\n";

cin>>m>>n;

cout<<"enter the elements of first matrix\n";

for(i=0;i<m;i++)

for(j=0;j<n;j++)

cin>>a[i][j];

cout<<"enter the elements of second matrix\n";

for(i=0;i<m;i++)

for(j=0;j<n;j++)

cin>>b[i][j];

};

void dom::check()

{

for(i=0;i<m;i++)

for(j=0;j<n;j++)

c[i][j]=a[i][j]+b[i][j];

};

void dom::disp()

{

cout<<"the sum of matrix is \n";

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

{

cout<<"\t"<<c[i][j];

}

cout<<"\n";

}

}

void main()

{

clrscr();

dom obj;

obj.get();

obj.check();

obj.disp();

getch();

}