You are on page 1of 7

#include<iostream>

#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>

using namespace std;

void input(int [],int ,int ,char);

void chart();

void first(int [],int ,char ,int );

void economy(int [],int ,char ,int );

void main()

int a[10] = { 0 }, x = 0, y = 5;

char c;

input(a,x,y,c);

system("pause");

void input(int a[10],int x,int y,char c)

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(a,x,c,y);

else if (i == 3)

economy(a,y,c,x);

else

exit(0);

}
else

cout << "\n\nNext Flight Fly After 3 Hours" << endl;

system("pause");

exit(0);

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(int a[10],int x,char c,int y)

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(a,y,c,x);

else

cout << "\n\nNext Flight Fly After 3 Hours" << endl;

x++;

input(a,x,y,c);

void economy(int a[10],int y,char c,int x)

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(a,x,c,y);

else

cout << "\n\nNext Flight Fly After 3 Hours" << endl;

y++;

input(a,x,y,c);

You might also like