tominator
12-09-2004, 10:06 PM
for this program i have to design an airline reservation program. i need to use a single array to reserve the seats. there are 10 seats available. 0-4 are first class, and 5-9 are economy. if one seat gets reserved the program should place a 1 on the seat (array) number...then it prints a voucher telling the seat number and if thier in first class or economy. the program shouldnt allow a reservation for a seat thats taken, it should print seat it taken. and when all the seats are filled up.....program should print next flight is in three hours.....im having trouble with this...heres what i did so far....can anyone help?
this is what i have so far.....
#include <iostream>
int seats[ 9 ];
int main()
{
int choice;
int count;
std::cout << "Welcome to the airline reservations system.\n";
std::cout << "Please type 1 for First Class or type 2 for Economy.\n";
std::cin >> choice;
if ( choice == 1 )
{
seats[ 0 ] = 1;
std::cout << "Your are seat Number:\n" ;
std::cout << "Your seat is in FIRST CLASS, have a nice flight.\n";
}
if ( choice == 2 )
{
seats[ 5 ] = 1;
std::cout << "You are seat number:\n" ;
std::cout << "Your seat is in the ECONOMY SECTION, have a nice flight.\n";
}
return 0;
}
this is what i have so far.....
#include <iostream>
int seats[ 9 ];
int main()
{
int choice;
int count;
std::cout << "Welcome to the airline reservations system.\n";
std::cout << "Please type 1 for First Class or type 2 for Economy.\n";
std::cin >> choice;
if ( choice == 1 )
{
seats[ 0 ] = 1;
std::cout << "Your are seat Number:\n" ;
std::cout << "Your seat is in FIRST CLASS, have a nice flight.\n";
}
if ( choice == 2 )
{
seats[ 5 ] = 1;
std::cout << "You are seat number:\n" ;
std::cout << "Your seat is in the ECONOMY SECTION, have a nice flight.\n";
}
return 0;
}