Create a Matrix in C++ Programming With Functions
#include<iostream.h>
#include<conio.h>
class matrix
{
int a[10][10],m,n,i,j;
public:
void getdata()
{
cout<<"\n Enter size of row && column ";
cin>>m>>n;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<"\n Enter element ";
cin>>a[i][j];
}
}
}
void putdata()
{
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
cout<<"\n "<<a[i][j];
}
}
}
};
void main()
{
matrix m1;
m1.getdata();
m1.putdata();
getch();
}
#include<conio.h>
class matrix
{
int a[10][10],m,n,i,j;
public:
void getdata()
{
cout<<"\n Enter size of row && column ";
cin>>m>>n;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<"\n Enter element ";
cin>>a[i][j];
}
}
}
void putdata()
{
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
cout<<"\n "<<a[i][j];
}
}
}
};
void main()
{
matrix m1;
m1.getdata();
m1.putdata();
getch();
}
Create a Matrix in C++ Programming With Functions
Reviewed by Unknown
on
6:06:00 PM
Rating:
No comments: