This is the program....I don't know how to start it....any help would be helpful.!!!!
Write a short code that promts the user to enter any 3 by 3 matrix, and then calculates its inverse.!!
:confused: :confused:
Printable View
This is the program....I don't know how to start it....any help would be helpful.!!!!
Write a short code that promts the user to enter any 3 by 3 matrix, and then calculates its inverse.!!
:confused: :confused:
Heh, perhaps you should reread your sig. :D Anyway, what have you got so far?
Here's a good place to start:
:DCode:#include <iostream>
using namespace std;
int main() {
// code here
// also here
}
well heres an example of taking in three values, might help.
Code:
#include <iostream.h>
int main()
{
int value1, value2, value3;
cout<<"Enter a value: ";
cin>>value1;
cout<<"Enter a value: ";
cin>>value2;
cout<<"Enter a value: ";
cin>>value3;
cout<<"The values u enterd were "<<value1
<<" "<<value2<<" "<<value3<<"."<<endl;
return 0;
}
use a multi- dimensional array...
so instead of having all those values, you could pass them through a function as well.
so something like this to start you off.
int matrix ( int [] , int[], int[]);
int main ()
{
cout<<" Enter three values for horizontal array.";
for ( int i = 0; i < 3 ; i ++ )
cin>>value [ i ] ;
then for the second dimension , you copy and paste the above code. im not writing this for you, so figure out the the function to pass the int[ ] through :)
HET TETRA REMEMBER THIS.....
"i am supposed to write a program that will assign seats on a ten seat plane. dont worry, im not asking you to write code for me im getting a little better at this but my teacher still sucks... so here is what i have.
btw. the program asks the person to pick a number , ( 1 for first class and 2 for seoncd.) im supposed to use arrays.... so..this is what i have but it doesnt work well... any help would be appreciated emensly." -TETRA
:) :) :D
I posted the code for the program...........did you ever look at IT???!!!!? Here it is again....:p
did this program a few days ago....here it is...the complete program......check if it works.....
Code://air
#include <iostream.h>
int main()
{
int plane[11]={0};
int choice;
int seatFound =1;
int Firstclass =1;
int Economy =6;
int people =1;
cout<< "Please type 1 for \"First Class\"" << endl;
cout<< "Please type 2 for \"Economy\"" << endl;
cin>> choice;
while (choice != -1)
{
if(choice==1)
{
seatFound= 0;
choice=1;
while (choice<6)
{
if(plane[choice]<1 && Firstclass <=5)
{
seatFound=choice;
plane[choice] =1;//put person in seat
choice=33;//exit loop
}
else
choice ++;
people++;
}
if(seatFound>0)//test if seat is found
{
cout<<"Boarding Pass"<<endl;
cout<<"-First Class-"<<endl;
cout<<"Seat#" << seatFound<<endl;
}
else
{
cout << "Do you want a seat in economy? " << endl;
cout << "\n1 = yes , 2 = no : ";
cin >> choice;
if ( choice == 2 )
{
seatFound=0;
choice=2;
while(plane[choice]<11)
{
if(plane[choice] > 0 && Economy <= 10 )
{
plane[choice]=2; // put someone in the seat
seatFound=choice;
choice=33;
}
else
choice++;
people++;
}
if(seatFound>0) //test if seat is found
{
cout<<"Boarding Pass"<<endl;
cout<<"Economy Class"<<endl;
cout<<"Seat#" << seatFound << endl;
}
}
else
{
cout << "Next flight leaves in three hours..." << endl;
}
}
}
else //economy class
{
seatFound=0;
choice=6;
while(plane[choice]<11)
{
if(plane[choice] < 1)
{
plane[choice]=1; // put someone in the seat
seatFound=choice;
choice =2;
}
else
choice++;
people++;
}
if(seatFound>0) //test if seat is found
{
cout<<"Boarding Pass"<<endl;
cout<<"Economy Class"<<endl;
cout<<"Seat#" << seatFound << endl;
}
else
{
cout << "Next flight leaves in three hours..." << endl;
}
}
cout<< "Please type 1 for \"First Class\" " << endl;
cout<< "Please type 2 for \"Economy\" " << endl;
cin>> choice;
}
return 0;
}
[code][/code]tagged by Salem
No, you're right, I was too lazy to look at it before. I love your subject line!
I think You must use Code Tags.. for posting codes...Quote:
Originally posted by Little Tito
I posted the code for the program...........did you ever look at IT???!!!!? Here it is again....:p
code:----------------------------------------------------------------------------
}
code------------------------------------------------------------------------------
instead of using your own.. for easy posting codes
Read this thread for help...
http://www.cprogramming.com/cboard/s...threadid=13473