#include<iostream.h>
#include<conio.h>
void main()
{
int *i,*j,*n1,*m1,*m2,*n2,*a[20],*b[20];
i=new int;
j=new int;
m1=new int;
n1=new int;
m2=new int;
n2=new int;
clrscr();
cout<<"enter the order of matrix A ";
cin>>*m1>>*n1;
for(*i=0;*i<*m1;(*i)++)
{
a[*i]=new int[*n1];
}
for((*i)=0;(*i)<(*m2);(*i)++)
{
b[*i]=new int[*n2];
}
cout<<"enter the elements of matrix A";
for((*i)=0;(*i)<(*m1);(*i)++)
{
for((*j)=0;(*j)<*n1;(*j)++)
{
cin>>a[*i][*j];
}
}
cout<<"enter the order of matrix B ";
cin>>*m2>>*n2;
for((*i)=0;*i<*m2;(*i)++)
{
for((*j)=0;*j<*n2;(*j)++)
{
cin>>b[*i][*j];
}
}
cout<<"the matrix A \n";
for(*i=0;*i<*m1;(*i)++)
{
for(*j=0;*j<*n1;(*j)++)
{
cout<<"\t"<<a[*i][*j];
}
cout<<"\n";
}
cout<<"the matrix B \n";
for((*i)=0;*i<*m1;(*i)++)
{
for((*j)=0;*j<*n1;(*j)++)
{
cout<<"\t"<<b[*i][*j];
}
cout<<"\n";
}
getch();
}
OUTPUT:
#include<conio.h>
void main()
{
int *i,*j,*n1,*m1,*m2,*n2,*a[20],*b[20];
i=new int;
j=new int;
m1=new int;
n1=new int;
m2=new int;
n2=new int;
clrscr();
cout<<"enter the order of matrix A ";
cin>>*m1>>*n1;
for(*i=0;*i<*m1;(*i)++)
{
a[*i]=new int[*n1];
}
for((*i)=0;(*i)<(*m2);(*i)++)
{
b[*i]=new int[*n2];
}
cout<<"enter the elements of matrix A";
for((*i)=0;(*i)<(*m1);(*i)++)
{
for((*j)=0;(*j)<*n1;(*j)++)
{
cin>>a[*i][*j];
}
}
cout<<"enter the order of matrix B ";
cin>>*m2>>*n2;
for((*i)=0;*i<*m2;(*i)++)
{
for((*j)=0;*j<*n2;(*j)++)
{
cin>>b[*i][*j];
}
}
cout<<"the matrix A \n";
for(*i=0;*i<*m1;(*i)++)
{
for(*j=0;*j<*n1;(*j)++)
{
cout<<"\t"<<a[*i][*j];
}
cout<<"\n";
}
cout<<"the matrix B \n";
for((*i)=0;*i<*m1;(*i)++)
{
for((*j)=0;*j<*n1;(*j)++)
{
cout<<"\t"<<b[*i][*j];
}
cout<<"\n";
}
getch();
}
OUTPUT:
No comments:
Post a Comment