BS (computer science)
programming issues by zeeshan..!!
Wednesday 2 April 2014
Monday 14 October 2013
Thursday 30 May 2013
program f matrix without class
#include<iostream.h>
#include<conio.h>
main()
{
int a[10][10],b[10][10],row,col,num,c[10][10],m,n,p,q,i,j,k;
cout<<"\n\t\t\t***********************";
cout<<"\n\t\t\t* PROGRAM OF MATRICES *";
cout<<"\n\t\t\t***********************";
cout<<"\n\n\n\n\t\tMade By:";
cout<<"\tzeeshan";
cout<<"\n\n\n\n\n\n\n\t\t\t\t\tPress any key to continue....!!";
getch();
do{
system("cls");
cout<<"\t\t\t"<<(char)2<<" MAIN MENU "<<(char)2<<endl<<endl;
cout<<"\t\t1.Addition of matrix"<<endl;
cout<<"\t\t2.Substraction of matrix"<<endl;
cout<<"\t\t3.Transpose of a matrix"<<endl;
cout<<"\t\t4.Multiplication of matrices\n"<<endl;
cout<<"\t\t5.Exit program\n\n";
cout<<"\n enter your choice :\n";
cin>>num;
switch(num)
{
case 1:
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][j]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the additon of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]+b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
getch();
break;
}
case 2:
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the substraction of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]-b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
getch();
break;
}
case 3:
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of matrix :"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
}
cout<<endl;
}
system("cls");
cout<<"\n your matrix :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[i][j];
cout<<" ";
}
cout<<endl<<endl;
}
cout<<"\n the transpose of your matrix :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[j][i];
cout<<" ";
}
cout<<endl<<endl;
}
getch();
break;
}
case 4:
{
system("cls");
cout<<(char)2<<" You can multiply two matrices if, and only if,\n";
cout<<" the number of columns in the first matrix equals\n";
cout<<"\n the number of rows in the second matrix. "<<endl<<endl;
cout<<"Enter rows and columns of first matrix:";
cin>>m>>n;
cout<<"Enter rows and columns of second matrix:";
cin>>p>>q;
if(n==p)
{
cout<<"\nEnter first matrix:\n";
for(i=0;i<m;++i)
for(j=0;j<n;++j)
cin>>a[i][j];
cout<<"\nEnter second matrix:\n";
for(i=0;i<p;++i)
for(j=0;j<q;++j)
cin>>b[i][j];
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<m;++i)
{for(j=0;j<n;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<p;++i)
{for(j=0;j<q;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"\nThe new matrix is:\n";
for(i=0;i<m;++i)
{
for(j=0;j<q;++j)
{
c[i][j]=0;
for(k=0;k<p;++k)
{ c[i][j]=c[i][j]+(a[i][k]*b[k][j]);}
cout<<c[i][j]<<" ";
}
cout<<"\n";
}
}
else
cout<<"\nSorry!!!! Matrix multiplication can't be done";
getch();
break;
}
case 5:
{
cout<<"\n\n\t\t\t\t\t\tbye...!!!";
}
}
}while(num!=5);
getch();
}
#include<conio.h>
main()
{
int a[10][10],b[10][10],row,col,num,c[10][10],m,n,p,q,i,j,k;
cout<<"\n\t\t\t***********************";
cout<<"\n\t\t\t* PROGRAM OF MATRICES *";
cout<<"\n\t\t\t***********************";
cout<<"\n\n\n\n\t\tMade By:";
cout<<"\tzeeshan";
cout<<"\n\n\n\n\n\n\n\t\t\t\t\tPress any key to continue....!!";
getch();
do{
system("cls");
cout<<"\t\t\t"<<(char)2<<" MAIN MENU "<<(char)2<<endl<<endl;
cout<<"\t\t1.Addition of matrix"<<endl;
cout<<"\t\t2.Substraction of matrix"<<endl;
cout<<"\t\t3.Transpose of a matrix"<<endl;
cout<<"\t\t4.Multiplication of matrices\n"<<endl;
cout<<"\t\t5.Exit program\n\n";
cout<<"\n enter your choice :\n";
cin>>num;
switch(num)
{
case 1:
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][j]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the additon of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]+b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
getch();
break;
}
case 2:
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the substraction of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]-b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
getch();
break;
}
case 3:
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of matrix :"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
}
cout<<endl;
}
system("cls");
cout<<"\n your matrix :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[i][j];
cout<<" ";
}
cout<<endl<<endl;
}
cout<<"\n the transpose of your matrix :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[j][i];
cout<<" ";
}
cout<<endl<<endl;
}
getch();
break;
}
case 4:
{
system("cls");
cout<<(char)2<<" You can multiply two matrices if, and only if,\n";
cout<<" the number of columns in the first matrix equals\n";
cout<<"\n the number of rows in the second matrix. "<<endl<<endl;
cout<<"Enter rows and columns of first matrix:";
cin>>m>>n;
cout<<"Enter rows and columns of second matrix:";
cin>>p>>q;
if(n==p)
{
cout<<"\nEnter first matrix:\n";
for(i=0;i<m;++i)
for(j=0;j<n;++j)
cin>>a[i][j];
cout<<"\nEnter second matrix:\n";
for(i=0;i<p;++i)
for(j=0;j<q;++j)
cin>>b[i][j];
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<m;++i)
{for(j=0;j<n;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<p;++i)
{for(j=0;j<q;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"\nThe new matrix is:\n";
for(i=0;i<m;++i)
{
for(j=0;j<q;++j)
{
c[i][j]=0;
for(k=0;k<p;++k)
{ c[i][j]=c[i][j]+(a[i][k]*b[k][j]);}
cout<<c[i][j]<<" ";
}
cout<<"\n";
}
}
else
cout<<"\nSorry!!!! Matrix multiplication can't be done";
getch();
break;
}
case 5:
{
cout<<"\n\n\t\t\t\t\t\tbye...!!!";
}
}
}while(num!=5);
getch();
}
program of matrix
#include<iostream.h>
#include<conio.h>
class matrix
{
int a[10][10];
int b[10][10];
int row,col,num,i,j;
public:
void start();
void add();
void sub();
void trans();
void mul();
};
void matrix::start()
{
do{
system("cls");
cout<<"\t\t\t"<<(char)2<<" MAIN MENU "<<(char)2<<endl<<endl;
cout<<"\t\t1.Addition of matrix"<<endl;
cout<<"\t\t2.Substraction of matrix"<<endl;
cout<<"\t\t3.Transpose of a matrix"<<endl;
cout<<"\t\t4.Multiplication of matrices\n"<<endl;
cout<<"\t\t5.Exit program\n\n";
cout<<"\n enter your choice :\n";
cin>>num;
switch(num)
{
case 1:
{
system("cls");
add();
break;
}
case 2:
{
system("cls");
sub();
break;
}
case 3:
{
system("cls");
trans();
break;
}
case 4:
{
system("cls");
mul();
break;
}
case 5:
{
cout<<"\n\n\t\t\t\t\t\tbye...!!!";
}
}
}while(num!=5);
getch();
}
void matrix::add()
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
cout<<" ";
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
cout<<" ";
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][j]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the additon of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]+b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
}
void matrix::sub()
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
cout<<" ";
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
cout<<" ";
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the substraction of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]-b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
}
void matrix::trans()
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
cout<<" ";
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<" your matrix :"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[i][j];
cout<<" ";
}
cout<<endl<<endl;
}
cout<<"\n the transpose of your matrix :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[j][i];
cout<<" ";
}
cout<<endl<<endl;
}
}
void matrix::mul()
{
int c[5][5],m,n,p,q,i,j,k;
cout<<(char)2<<" You can multiply two matrices if, and only if,\n";
cout<<" the number of columns in the first matrix equals\n";
cout<<"\n the number of rows in the second matrix. "<<endl<<endl;
cout<<"Enter rows and columns of first matrix:";
cin>>m>>n;
cout<<"Enter rows and columns of second matrix:";
cin>>p>>q;
if(n==p)
{
cout<<"\nEnter first matrix:\n";
for(i=0;i<m;++i)
for(j=0;j<n;++j)
cin>>a[i][j];
cout<<"\nEnter second matrix:\n";
for(i=0;i<p;++i)
for(j=0;j<q;++j)
cin>>b[i][j];
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<m;++i)
{for(j=0;j<n;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<p;++i)
{for(j=0;j<q;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"\nThe new matrix is:\n";
for(i=0;i<m;++i)
{
for(j=0;j<q;++j)
{
c[i][j]=0;
for(k=0;k<p;++k)
{ c[i][j]=c[i][j]+(a[i][k]*b[k][j]);}
cout<<c[i][j]<<" ";
}
cout<<"\n";
}
}
else
cout<<"\nSorry!!!! Matrix multiplication can't be done";
}
main()
{
system("cls");
matrix h;
cout<<"\n\t\t\t***********************";
cout<<"\n\t\t\t* PROGRAM OF MATRICES *";
cout<<"\n\t\t\t***********************";
cout<<"\n\n\n\n\t\tMade By:";
cout<<"\tzeeshan";
cout<<"\n\n\n\n\n\n\n\t\t\t\t\tPress any key to continue....!!";
getch();
h.start();
}
#include<conio.h>
class matrix
{
int a[10][10];
int b[10][10];
int row,col,num,i,j;
public:
void start();
void add();
void sub();
void trans();
void mul();
};
void matrix::start()
{
do{
system("cls");
cout<<"\t\t\t"<<(char)2<<" MAIN MENU "<<(char)2<<endl<<endl;
cout<<"\t\t1.Addition of matrix"<<endl;
cout<<"\t\t2.Substraction of matrix"<<endl;
cout<<"\t\t3.Transpose of a matrix"<<endl;
cout<<"\t\t4.Multiplication of matrices\n"<<endl;
cout<<"\t\t5.Exit program\n\n";
cout<<"\n enter your choice :\n";
cin>>num;
switch(num)
{
case 1:
{
system("cls");
add();
break;
}
case 2:
{
system("cls");
sub();
break;
}
case 3:
{
system("cls");
trans();
break;
}
case 4:
{
system("cls");
mul();
break;
}
case 5:
{
cout<<"\n\n\t\t\t\t\t\tbye...!!!";
}
}
}while(num!=5);
getch();
}
void matrix::add()
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
cout<<" ";
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
cout<<" ";
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][j]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the additon of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]+b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
}
void matrix::sub()
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of first matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of first matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
cout<<" ";
}
cout<<endl;
}
cout<<" enter values of 2nd matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of 2nd matrix
{
for(j=0;j<row;j++)
{
cin>>b[i][j];
cout<<" ";
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"the substraction of your matices is :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
a[i][j]=a[i][j]-b[i][j];
cout<<a[i][j]<<" ";
}
cout<<endl<<endl;
}
}
void matrix::trans()
{
system("cls");
cout<<" enter number of rows :"<<endl;
cin>>row;
cout<<" enter number of columns :"<<endl;
cin>>col;
cout<<" enter values of matrix :"<<endl;
for(i=0;i<col;i++) //to enter values of matrix
{
for(j=0;j<row;j++)
{
cin>>a[i][j];
cout<<" ";
}
cout<<endl;
}
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<row;++i)
{for(j=0;j<col;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<" your matrix :"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[i][j];
cout<<" ";
}
cout<<endl<<endl;
}
cout<<"\n the transpose of your matrix :\n"<<endl;
for(i=0;i<col;i++)
{
for(j=0;j<row;j++)
{
cout<<a[j][i];
cout<<" ";
}
cout<<endl<<endl;
}
}
void matrix::mul()
{
int c[5][5],m,n,p,q,i,j,k;
cout<<(char)2<<" You can multiply two matrices if, and only if,\n";
cout<<" the number of columns in the first matrix equals\n";
cout<<"\n the number of rows in the second matrix. "<<endl<<endl;
cout<<"Enter rows and columns of first matrix:";
cin>>m>>n;
cout<<"Enter rows and columns of second matrix:";
cin>>p>>q;
if(n==p)
{
cout<<"\nEnter first matrix:\n";
for(i=0;i<m;++i)
for(j=0;j<n;++j)
cin>>a[i][j];
cout<<"\nEnter second matrix:\n";
for(i=0;i<p;++i)
for(j=0;j<q;++j)
cin>>b[i][j];
system("cls");
cout<<"\nfirst matrix:\n";
for(i=0;i<m;++i)
{for(j=0;j<n;++j)
{cout<<a[i][i]<<" ";}
cout<<endl;}
cout<<"\nsecond matrix:\n";
for(i=0;i<p;++i)
{for(j=0;j<q;++j)
{cout<<b[i][j]<<" ";}
cout<<endl;}
cout<<"\nThe new matrix is:\n";
for(i=0;i<m;++i)
{
for(j=0;j<q;++j)
{
c[i][j]=0;
for(k=0;k<p;++k)
{ c[i][j]=c[i][j]+(a[i][k]*b[k][j]);}
cout<<c[i][j]<<" ";
}
cout<<"\n";
}
}
else
cout<<"\nSorry!!!! Matrix multiplication can't be done";
}
main()
{
system("cls");
matrix h;
cout<<"\n\t\t\t***********************";
cout<<"\n\t\t\t* PROGRAM OF MATRICES *";
cout<<"\n\t\t\t***********************";
cout<<"\n\n\n\n\t\tMade By:";
cout<<"\tzeeshan";
cout<<"\n\n\n\n\n\n\n\t\t\t\t\tPress any key to continue....!!";
getch();
h.start();
}
Subscribe to:
Posts (Atom)