c++ project about matrices :S

First of all i would like to thanks everyone here for providing help, i got so much help from this forum which made me joining it, and i hope to provide any kind of help.

secondly, i'm working on a prject that is supposed to ask the user to enter the dimension of matrices and then add or subtract or multiply or find the transpose of the inverse of the matrix and i have to gove it on monday, i did the program and i knw its nt very good but i did what i can and now its not working properly so if any1 can take a look at it and c if there's anything wrng with it and if u have any suggestions to make it better.
I appreciate any help from you.thanks

The Program:
-----------------

#include<iostream>
using namespace std;
void main()
{
int ia,ja,ib,jb,ma,na,mb,nb,q,s;
float a[10][10], b[10][10],R;
unsigned short int choice; char T,Inv,choice2;
int c[2][2];
float z = a[0][0]*a[1][1] - a[0][1]*a[1][0] ;
float z1 = b[0][0]*b[1][1] - b[0][1]*b[1][0] ;


cout<<"\nEnter dimensions for Matrix A: "; cin>>ma>>na;

cout<<"\nEnter elements for Matrix A:\n";
for(ia=1; ia<=ma; ia++)
{
for(ja=1; ja<=na; ja++)
{
cout <<"( "<< ia << "," << ja<< ") = "; cin >> a[ia][ja];
}
}
cout<<"\nEnter dimensions for Matrix B: "; cin>>mb>>nb;

cout<<"\nEnter elements for Matrix B:\n";
for(ib=1; ib<=mb; ib++)
{
for(jb=1; jb<=nb; jb++)
{
cout <<"( "<< ib << "," << jb<< ") = "; cin >> b[ib][jb];
}
}
again:
cout<<"\nChoose the operation you want (1--->6):\n";
cout<<"\n(1)Addition\n(2)Subtraction\n(3)Multiplication\n(4)Transpose Of A or B\n(5)Find The Inverse Of A or B (only for 2x2 matrix)\n(6)Exit\n";
cin>>choice;
if(choice<1 || choice>6)
{
cout<<"\nInvalid choice.....Please Try again\n\n";
system("pause");
system("cls");
goto again;
}
if(choice==6) goto endprog;
switch(choice)
{
case 1:R=a[ia][ja]+b[ib][jb]; break;
case 2:R=a[ia][ja]-b[ib][jb]; break;
case 3:R=a[ia][ja]*b[ib][jb];
cout<<"\nThe Result = "<<R<<endl;
}


if(choice==4)
{
Transpose:
cout<<"\nEnter The Matrix you want to Transpose: "; cin>>T;
if(T=='A')
{
cout<<"\nThe Transpose of Matrix A is: \n"<<"A"<<a[ja][ia]<<endl;
}
}
else
if(T=='B')
{
cout<<"\nThe Transpose of Matrix B is: \n"<<"B"<<b[jb][ib]<<endl;
}


else
cout<<"\nInvalid choise.....Please Try Again\n\n";
system("pause");
system("cls");
goto Transpose;

if(choice==5)
{
MatrixInv:
cout<<"\nFind The Matrix Of: "; cin>>Inv;
if(Inv=='A')
{
c[0][0] = a[1][1] / z ;
c[0][1]= -1 * a[0][1] / z ;
c[1][0]= -1 * a[1][0] / z ;
c[1][1]= a[0][0] / z ;

for (q=0 ; q <2 ;q++)
{
for (s=0; s < 2 ;s++)
cout<<"\nThe Inverse Of Matrix A is: "<<c[ia][ja]<<endl;
}


}
else
if(Inv='B')
{
c[0][0] = b[1][1] / z1 ;
c[0][1]= -1 * b[0][1] / z1 ;
c[1][0]= -1 * b[1][0] / z1 ;
c[1][1]= b[0][0] / z1 ;

for (q=0 ; q <2 ;q++)
{
for (s=0; s < 2 ;s++)
cout<<"\nThe Inverse Of Matrix B is: "<<c[ib][jb]<<endl;
}
}

else
cout<<"\nInvalid choise.....Please Try Again\n\n";
system("pause");
system("cls");
goto MatrixInv;

}

cout<<"Do You Want To Do This Again ? (Y/N): "; cin>>choice2;
if(choice2=='Y')
{
system("cls")
goto again:
}
else
if(choice2=='N')
{
goto endprog;
}




endprog:
cout<<"Thank You :)";
cout<<endl; system("pause");
}





You should eliminate the goto's. (You are simulating function calls and the outer loop.)

You should use more switches.

Also, you have used = where you meant == in a few places.

Do a wholesale rewrite with an eye to the above.
That will probably fix the problem, too.
And in future, remember to use code tags when posting code.
Topic archived. No new replies allowed.