AboutPrince M. Premnath Expertise Years of research in C/C++ Will bring you all facts regarding , OOPS , SVGA , MOUSE , BIOS , IVT , Feel free to query me :-)
Question Hi! This is my first semester programming and I have homework assignemt. Assignment is I need to write a program to do matrix multiplication (limit a program to 3*3) and I have to draw a structure chart. Can you please help me! Thank you so much.
Answer Hai Dear Ravi!
Here is the programme what actually you are looking for !
#include <iostream.h>
int main()
{
int a[3][3] , b[3][3] , c[3][3];
int i , j , k;
cout<<"Enter A matrix ";
for( i = 0 ; i < 3 ; i++)
for( j = 0 ; j < 3 ; j++)
cin>> a[i][j];
cout<<"Enter B matrix ";
for( i = 0 ; i < 3 ; i++)
for( j = 0 ; j < 3 ; j++)
cin>>b[i][j];
for( i = 0 ; i < 3 ; i++)
{
for( j = 0; j < 3 ; j++)
{
c[i][j] = 0;
for( k = 0 ; k < 3 ; k++)
c[i][j] += a[i][k]*b[k][j];
}
}
cout<<"The resultant matrix is : ";
for( i = 0 ; i < 3 ; i++)
{
for( j = 0 ; j < 3 ; j++)
cout<<c[i][j];
cout<<"\n";
}
return 0;
}
In order to draw th structure chart , you should be familiar with the notations used in the structure chart , so i kindly request you to visit the following link to understand the notations !