Professional Documents
Culture Documents
#include<iomanip>
using namespace std;
void chart();
void first();
void economy();
int a[10] = { 0 }, x = 0, y = 5;
char c;
void main()
{
cout << " \t " << setw(45) << setfill('*') << "***" << endl;
cout << " \t *" << setw(44) << setfill(' ') << " *" << endl;
cout << " \t *";
cout << " Welcome to Airline Reservation System *" << endl;
cout << " \t *" << setw(44) << setfill(' ') << " *" << endl;
cout << " \t " << setw(45) << setfill('*') << "***" << endl;
int i;
cout << "\n\n1.Seat Number Chart" << endl;
cout << "2.First Class" << endl;
cout << "3.Economy Class" << endl;
cout << "For Exit Press Any Other Key" << endl;
cout << "Select" << endl;
if (x<5||y<10)
{
cin >> i;
if (i == 1)
{
chart();
}
else if (i == 2)
{
first();
}
else if (i == 3)
{
economy();
}
else
{
exit(0);
}
}
else
{
cout << "\n\nNext Flight Fly After 3 Hours" << endl;
system("pause");
exit(0);
}
system("pause");
}
void chart()
{
cout << "First Class Seats : " << endl;
for (int i = 0; i < 5; i++)
{
cout << "Seat Number : " << i + 1 << endl;
}
cout << "Economy Class Seats : " << endl;
for (int i = 5; i < 10; i++)
{
cout << "Seat Number : " << i + 1 << endl;
}
main();
}
void first()
{
if (x<5)
{
a[x] = x + 1;
cout << "Your Seat Number is " << a[x] << endl;
cout << "Your Seat is in First Class" << endl;
}
if (x >= 5)
{
cout << "Seats in First Class are All Booked." << endl;
cout << "If You Want to Book a Seat in Economy Class? " << endl;
cin >> c;
if (c == 'y' || c == 'Y')
{
economy();
}
else
{
cout << "\n\nNext Flight Fly After 3 Hours" << endl;
}
}
x++;
main();
}
void economy()
{
if (y<10)
{
a[y] = y + 1;
cout << "Your Seat Number is " << a[y] << endl;
cout << "Your Seat is in Economy Class" << endl;
}
if (y >= 10)
{
cout << "Seats in Economy Class are All Booked." << endl;
cout << "If You Want to Book a Seat in First Class? " << endl;
cin >> c;
if (c == 'y' || c == 'Y')
{
first();
}
else
{
cout << "\n\nNext Flight Fly After 3 Hours" << endl;
}
}
y++;
main();
}
#include<iostream>
#include<iomanip>
void chart();
void main()
int a[10] = { 0 }, x = 0, y = 5;
char c;
input(a,x,y,c);
system("pause");
cout << " \t " << setw(45) << setfill('*') << "***" << endl;
cout << " \t *" << setw(44) << setfill(' ') << " *" << endl;
cout << " \t *" << setw(44) << setfill(' ') << " *" << endl;
cout << " \t " << setw(45) << setfill('*') << "***" << endl;
int i;
cout << "For Exit Press Any Other Key" << endl;
if (x<5||y<10)
cin >> i;
if (i == 1)
chart();
else if (i == 2)
first(a,x,c,y);
else if (i == 3)
economy(a,y,c,x);
else
exit(0);
}
else
system("pause");
exit(0);
void chart()
main();
if (x<5)
a[x] = x + 1;
cout << "Your Seat Number is " << a[x] << endl;
if (x >= 5)
cout << "Seats in First Class are All Booked." << endl;
cout << "If You Want to Book a Seat in Economy Class? " << endl;
cin >> c;
if (c == 'y' || c == 'Y')
economy(a,y,c,x);
else
x++;
input(a,x,y,c);
if (y<10)
a[y] = y + 1;
cout << "Your Seat Number is " << a[y] << endl;
if (y >= 10)
{
cout << "Seats in Economy Class are All Booked." << endl;
cout << "If You Want to Book a Seat in First Class? " << endl;
cin >> c;
if (c == 'y' || c == 'Y')
first(a,x,c,y);
else
y++;
input(a,x,y,c);