You are on page 1of 23

#include<iostream.

h>

#include<iomanip.h>

#include<conio.h>

#include<string.h>

#include<stdlib.h>

#include<fstream.h>

#include<dos.h>

#include<graphics.h>

char l_destination[5][20]={"COCHIN","DELHI","MUMBAI","KOLKATTA","CHENNAI"};

char i_destination[10][20]={"LONDON","BERLIN","DUBAI","NEW YORK","BEIJING","PARIS","CAPE


TOWN","TOKYO","LOS ANGELES","SYDNEY" };

class mytime

protected:

int choose;

public:

void getdata()

cout<<"ON WHICH TIME YOU WANT TO TRAVEL"<<endl;

cout<<"ENTER 1 FOR 11 PM"<<endl;

cout<<"ENTER 2 FOR 3 PM"<<endl;

cout<<"ENTER 3 FOR 9 AM"<<endl;

cout<<"Enter your choice : ";

cin>>choose;

void show()
{

if(choose==1)

cout<<"|Flight Time 11 AM "<<endl;

cout<<"|_________________________________________________________________________"<<en
dl;

cout<<" HAVE A SAFE JOURNEY "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"| "<<endl<<

"|Flight Time 11 AM "<<endl<<

"|_________________________________________________________________________"<<endl<<

" HAVE A SAFE JOURNEY "<<endl;

if(choose==2)

cout<<"|Flight Time 10 AM "<<endl;

cout<<"|_________________________________________________________________________"<<en
dl;

cout<<" HAVE A SAFE JOURNEY "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"| "<<endl<<

"|Flight Time 10 AM "<<endl<<


"|_________________________________________________________________________"<<endl<<

" HAVE A SAFE JOURNEY "<<endl;

if(choose==3)

cout<<"|Flight Time 9 AM "<<endl;

cout<<"|_________________________________________________________________________"<<en
dl;

cout<<" HAVE A SAFE JOURNEY "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"| "<<endl<<

"|Flight Time 9 AM "<<endl<<

"|_________________________________________________________________________"<<endl<<

" HAVE A SAFE JOURNEY "<<endl;

};

class passenger

public:

virtual void getdata()

}
virtual void show()

};

class booking:public passenger

protected:

int num;

char ch;

char firstname[60];

char lastname[60];

char address[60];

char c_loc[30];

char dest[30];

char reservation_no[60];

int option;

public:

void getdata()

cout<<setw(40)<<"\n\n ::Please enter the required information::"<<endl;

cout<<"\n\n\nEnter the firstname of passenger: ";

cin.getline(firstname,60);

cout<<endl;

cout<<"Enter the lastname of passenger: ";

cin.getline(lastname,60);
cout<<endl;

cout<<"Enter address of passenger: ";

cin.getline(address,60);

cout<<endl;

cout<<"Enter the Reservation No. of Ticket: ";

cin.getline(reservation_no,60);

cout<<endl;

cout<<"Enter the current location of passenger: ";

cin.getline(c_loc,60);

cout<<endl;

cout<<"Enter the destination of passenger: ";

cin.getline(dest,60);

cout<<endl;

clrscr();

void show()

cout<<setw(40)<<"Your E-Ticket is :"<<endl;

int t=1;

int r=12345;

cout<<" AIRLINE TICKET "<<endl;

cout<<"|Ticket No."<<t<<" Reference No."<<r<<"\t "<<endl;

cout<<"|Reservation No. : "<<reservation_no<<" "<<endl;

cout<<"|Total Price : $ 1500 "<<endl;


cout<<"|__________________________________________________________________________"<<e
ndl;

cout<<"|Passenger Information : "<<endl;

cout<<"|Name : "<<lastname<<"/"<<firstname<<" "<<endl;

cout<<"|Address :"<<address<<" "<<endl;

cout<<"|_________________________________________________________________________"<<en
dl;

cout<<"|Flight Information : "<<endl;

cout<<"|12 aug 2019 "<<endl;

cout<<"|BOING 747 "<<endl;

cout<<"|Depart :"<<c_loc<<" "<<endl;

cout<<"|Arrive :"<<dest<<" "<<endl;

cout<<"|*BAGGAGE allowed 40 Kilos "<<endl;

cout<<"|_________________________________________________________________________"<<en
dl;

ofstream outfile("E:\\E_ticket.txt");

outfile<<" AIRLINE TICKET "<<endl<<

"|Ticket No."<<t<<" Reference No."<<r<<"\t "<<endl<<

"|Reservation No. :"<<reservation_no<<" "<<endl<<

"|Total Price : $ 1500 "<<endl<<

"|__________________________________________________________________________"<<endl<<

"|Passenger Information : "<<endl<<

"|Name :"<<lastname<<"/"<<firstname<<" "<<endl<<

"|Address :"<<address<<" "<<endl<<


"|_________________________________________________________________________"<<endl<<

"|Flight Information : "<<endl<<

"|12 aug 2019 "<<endl<<

"|BOING 747 "<<endl<<

"|Depart :"<<c_loc<<" "<<endl<<

"|Arrive :"<<dest<<" "<<endl<<

"|*BAGGAGE allowed 40 Kilos "<<endl<<

"|_________________________________________________________________________"<<endl;

t=t+1;

r=r+1;

};

class search

public:

void searching()

cout<<"FOLLOWING ARE THE INTERNATIONAL FLIGHTS AVAILABLE"<<endl;

for(int i=0;i<5;i++)

for(int j=0;j<10;j++)

cout<<"FLIGHT FROM "<<l_destination[i]<<" TO "<<i_destination[j]<<endl;

}
}

};

class local: public booking

protected:

int b_seat;

int e_seat;

int ch;

int k;

int p;

int option;

mytime t1;

public:

void getdata()

k=0;

p=0;

cout<<"In which AIRLINE you want to travel"<<endl<<endl;

cout<<"1)PIA"<<endl;

cout<<"2)AIR BLUE"<<endl;

cout<<"3)ARAB EMIRATES"<<endl;

cout<<"4)QATAR AIRWAYS"<<endl;

cout<<"Enter your choice : ";

cin>>option;

clrscr();
switch(option)

case 1:

if (option==1)

cout<<setw(40)<<"\n\n\n WELCOME TO PIA"<<endl;

break;

case 2:

if(option==2)

cout<<setw(40)<<"\n\n\n WELCOME TO AIRBLUE"<<endl;

break;

case 3:

if(option==3)

cout<<setw(40)<<"\n\n\n WELCOME TO ARAB EMIRATES"<<endl;

break;

case 4:

if(option==4)

cout<<setw(40)<<"\n\n\n WELCOME TO QATAR AIRWAYS"<<endl;

break;

cout<<setw(40)<<"\nTHESE ARE THE LOCAL PLACES AVAILABLE\n\n\n"<<endl;

cin.ignore();

for(int i=0;i<5;i++)

cout<<l_destination[i]<<endl;

}
booking::getdata();

for(int j=0;j<5;j++)

if(strcmpi(l_destination[j],c_loc)==0)

k++;

for( i=0;i<5;i++)

if(strcmpi(l_destination[i],c_loc)==0)

p++;

if(k==1&&p==1)

cout<<" FLIGHT AVAILABLE ON THIS ROUTE"<<endl;

b_seat=30;

e_seat=40;

cout<<"In which class you want to travel?"<<endl;

cout<<"Make your choice"<<endl<<endl;

cout<<"\n\n\n\n\n\n";

cout<<setw(60)<<"*************************************"<<endl;

cout<<setw(60)<<"* Enter 1 for business class *"<<endl;


cout<<setw(60)<<"* Enter 2 for economy class *"<<endl;

cout<<setw(60)<<"*************************************"<<endl<<endl<<endl<<endl;

cout<<"Enter your choice : ";

cin>>ch;

cout<<endl;

switch(ch)

case 1:

b_seat--;

if(b_seat<=0)

cout<<"SORRY NO SEAT AVAILABLE"<<endl;

else

cout<<"SEAT AVAILABLE"<<endl;

break;

case 2:

e_seat--;

if(e_seat<=0)

cout<<"SORRY NO SEAT AVAILABLE"<<endl;

else

cout<<"SEAT AVAILABLE"<<endl;

break;

t1.getdata();

clrscr();

booking::show();
if(ch==1)

cout<<"| "<<endl;

cout<<"|Ticket Information: "<<endl;

cout<<"|BUSINESS CLASS "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"| "<<endl<<

"|Ticket Information: "<<endl<<

"|BUSINESS CLASS "<<endl;

if(ch==2)

cout<<"| "<<endl;

cout<<"|Ticket Information: "<<endl;

cout<<"|ECONOMY CLASS "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"| "<<endl<<

"|Ticket Information: "<<endl<<

"|ECONOMY CLASS "<<endl;

cout<<"|Status: confirmed "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"|Status: confirmed "<<endl;

t1.show();

else

cout<<"__________________________________________________________________________"<<en
dl;

cout<<"| SORRY NO FLIGHT AVAILABLE ON THIS ROUTE RIGHT NOW "<<endl;

cout<<"__________________________________________________________________________"<<en
dl;

};

class international:public booking

protected:

int b1_seat;

int e1_seat;

int choice;

int c;

int b;

int v;

char g;

mytime t1;

public:
void getdata()

b=0;

v=0;

cout<<"In which AIRLINE you want to travel"<<endl<<endl;

cout<<"1)PIA"<<endl;

cout<<"2)AIR BLUE"<<endl;

cout<<"3)ARAB EMIRATES"<<endl;

cout<<"4)QATAR AIRWAYS"<<endl;

cout<<"Enter your choice"<<endl;;

cin>>option;

clrscr();

switch(option)

case 1:

if (option==1)

cout<<setw(40)<<"\n\n\n WELCOME TO PIA"<<endl;

break;

case 2:

if(option==2)

cout<<setw(40)<<"\n\n\n WELCOME TO AIRBLUE"<<endl;

break;

case 3:

if(option==3)

cout<<setw(40)<<"\n\n\n WELCOME TO ARAB EMIRATES"<<endl;


break;

case 4:

if(option==4)

cout<<setw(40)<<"\n\n\n WELCOME TO QATAR AIRWAYS"<<endl;

break;

cout<<"\n\nTHESE ARE THE INTERNATIONAL PLACES AVAILABLE"<<endl<<endl;

cin.ignore();

for(int i=0;i<10;i++)

cout<<i_destination[i]<<endl;

booking::getdata();

for(int j=0;j<10;j++)

if(strcmpi(i_destination[j],dest)==0)

v++;

for( i=0;i<5;i++)

if(strcmpi(l_destination[i],c_loc)==0)

b++;
}

if(b==1&&v==1)

cout<<" FLIGHT AVAILABLE ON THIS ROUTE"<<endl;

b1_seat=30;

e1_seat=40;

cout<<"In which class you want to travel?"<<endl;

cout<<"Make your choice"<<endl<<endl;

cout<<"\n\n\n\n\n\n";

cout<<setw(60)<<"*************************************"<<endl;

cout<<setw(60)<<"* Enter 1 for business class *"<<endl;

cout<<setw(60)<<"* Enter 2 for economy class *"<<endl;

cout<<setw(60)<<"*************************************"<<endl<<endl<<endl<<endl;

cout<<"Enter your choice"<<endl;

cin>>choice;

cout<<endl;

switch(choice)

case 1:

b1_seat--;

if(b1_seat<=0)

cout<<"SORRY NO SEAT AVAILABLE"<<endl;

else

cout<<"SEAT AVAILABLE"<<endl;
break;

case 2:

e1_seat--;

if(e1_seat<=0)

cout<<"SORRY NO SEAT AVAILABLE"<<endl;

else

cout<<"SEAT AVAILABLE"<<endl;

break;

t1.getdata();

clrscr();

booking::show();

if(choice==1)

cout<<"| "<<endl;

cout<<"|Ticket Information: "<<endl;

cout<<"|BUSINESS CLASS "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"| "<<endl<<

"|Ticket Information: "<<endl<<

"|BUSINESS CLASS "<<endl;

if(choice==2)

{
cout<<"| "<<endl;

cout<<"|Ticket Information: "<<endl;

cout<<"|ECONOMY CLASS "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"| "<<endl<<

"|Ticket Information: "<<endl<<

"|ECONOMY CLASS "<<endl;

cout<<"|Status: confirmed "<<endl;

ofstream outfile;

outfile.open("E:\\E_ticket.txt",ios::app);

outfile<<"|Status: confirmed "<<endl;

t1.show();

else

cout<<"__________________________________________________________________________"<<en
dl;

cout<<"| SORRY NO FLIGHT AVAILABLE ON THIS ROUTE RIGHT NOW "<<endl;

cout<<"__________________________________________________________________________"<<en
dl;

};
class main1

private:

char f;

int menu_choice;

char a;

public:

void getdata()

m:

cout<<"\n\n\n\n\n\n";

cout<<setw(60)<<"*************************************"<<endl;

cout<<setw(60)<<"* AIRWAYS RESERVATION *"<<endl;

cout<<setw(60)<<"* MAIN MENU *"<<endl;

cout<<setw(60)<<"* ENTER 1 FOR LOCAL BOOKING *"<<endl;

cout<<setw(60)<<"* ENTER 2 FOR INTERNATIONAL BOOKING *"<<endl;

cout<<setw(60)<<"* ENTER 3 FOR VIEWING ALL FLIGHTS *"<<endl;

cout<<setw(60)<<"* ENTER 4 FOR EXITING *"<<endl;

cout<<setw(60)<<"*************************************"<<endl;

cout<<" NOW ENTER YOUR CHOICE : ";

cin>>menu_choice;

clrscr();

passenger* p1;

booking b1;

international i1;
local l1;

char back;

switch(menu_choice)

case 1:

p1=&l1;

p1->getdata();

cout<<"To Go To Main Menu Enter b"<<endl;

cin>>back;

clrscr();

if (back=='b')

goto m;

else

cout<<"\n\n\n\n\n\n";

cout<<setw(40)<<"BYE FROM AIR RESERVATION SYSTEM";

sleep(2);

break;

case 2:

p1=&i1;

p1->getdata();

cout<<"To Go To Main Menu Enter b"<<endl;


cin>>back;

clrscr();

if (back=='b')

goto m;

else

cout<<"\n\n\n\n\n\n";

cout<<setw(40)<<"BYE FROM AIR RESERVATION SYSTEM";

sleep(2);

break;

case 3:

search s1;

s1.searching();

cout<<"To Go To Main Menu Enter b"<<endl;

cin>>back;

clrscr();

if (back=='b')

goto m;

else

{
cout<<"\n\n\n\n\n\n";

cout<<setw(40)<<"BYE FROM AIR RESERVATION SYSTEM";

sleep(2);

break;

case 4: cout<<"\n\n\n\n\n\n";

cout<<setw(40)<<"BYE FROM AIR RESERVATION SYSTEM";

sleep(2);

exit(0);

break;

default: cout<<"INVALID CHOICE!!";

};

void main()

clrscr();

cout<<"\n\n\t\t";

textcolor(LIGHTGREEN);

cprintf(" WELCOME TO AIRWAYS RESERVATION SYSTEM");

sleep(3);

clrscr();

cout<<"\n\n\t\t";

textcolor(LIGHTBLUE);

cprintf(" Developed by :");


sleep(1);

textcolor(LIGHTCYAN);

cprintf(" A.Shankar Mahadevan");

sleep(1);

cout<<"\n\n\n\t\t";

textcolor(LIGHTCYAN);

cprintf(" Giridhar S Shenoy ");

sleep(1);

cout<<"\n\n\n\t\t";

textcolor(LIGHTCYAN);

cprintf(" Aswin Filton ");

sleep(2);

clrscr();

main1 m1;

m1.getdata();

You might also like