i executed it and it found 26 errors, i am not able to clear them, please help me and do tell me where i got wrong
#include<iostream.h>
#include<conio.h>
float add(float, float);
float sub(float, float);
float mult(float, float);
float div(float, float);
int main()
{
int i,j,ch;
float a[3][3],b[3][3];
cout<<"Enter Matrix A \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];
}
}
cout<<"Enter Matrix B \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];
}
}
//Displaying Matrices
cout<<"Matrix A"<<"\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<a[i][j]<<"\t";
}
cout<<"\n";
}
cout<<"Matrix B"<<"\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<a[i][j]<<"\t";
}
cout<<"\n";
}
cout<<"Enter 1 for Addition"<<"\n";
cout<<"Enter 2 for Subtraction \n";
cout<<"Enter 3 for multiplication \n";
cout<<"Enter 4 for Division \n";
cin>>ch;
switch(ch)
{
case 1: int y=add(a[][],b[][]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<y[i][j]<<"\t";
}
cout<<"\n";
}
case 2: int x=sub(a[][], b[][]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<x[i][j]<<"\t";
}
cout<<"\n";
}
case 3: int z=mult(a[][],b[][]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<z[i][j]<<"\t";
}
cout<<"\n";
}
case 4: int w=div(a[][].b[][]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<w[i][j]<<"\t";
}
cout<<"\n";
}
default :cout<<"Wrong Choice Entered, Aborting";
exit(0);
}
return 0;
}
float add(c[][],d[][])
{
int k,l;
float e[3][3];
for(k=0;k<3;k++)
{
for(l=0;l<3;l++)
{
e[i][j]=c[i][j]+d[i][j];
}
}
return e[i][j];
}
float sub(c[][],d[][])
{
int k,l;
float e[3][3];
for(k=0;k<3;k++)
{
for(l=0;l<3;l++)
{
e[i][j]=c[i][j]-d[i][j];
}
}
return e[i][j];
}
float mult(c[][],d[][])
{
int k,l;
float e[3][3];
for(k=0;k<3;k++)
{
for(l=0;l<3;l++)
{
e[i][j]=c[i][j]*d[i][j];
}
}
return e[i][j];
}
float div(c[][],d[][])
{
int k,l;
float e[3][3];
for(k=0;k<3;k++)
{
for(l=0;l<3;l++)
{
e[i][j]=c[i][j]/d[i][j];
}
}
return e[i][j];
}
**Mod Edit: Changed title to be more descriptive**
This post has been edited by OliveOyl3471: 31 January 2010 - 01:43 PM

New Topic/Question
Reply



MultiQuote








|