Tuesday, 23 April 2013

AIRWAYS RESERVATION SYSTEM PROJECT

Description:

This Project is an online ticket booking system. A computer reservation system which is used for the reservations of a particular airline. This project is built in C++ and is tested in Visual Studio 2012. It performs following functions:

  1. Local Booking
  2. International Booking
  3. Available Flights

PREPARED BY:

AFRAZ AHMED KHAN
RANA JAHANZEB



Download Complete Working Code:


Buy Now


See Video Demo - Airline Reservation System:



CODE:

#include<iostream>
#include<iomanip>
#include<conio.h>
#include<string>
#include<windows.h>
#include<fstream>
using namespace std;

   char l_destination[5][20]={"LAHORE","ISLAMABAD","KARACHI","PESHAWAR","QUETTA"};
       char i_destination[10][20]={"LONDON","BERLIN","DUBAI","NEW YORK","BEIJING","PARIS","CAPE TOWN","TOKYO","LOS ANGELES","MUMBAI" };
class mytime
{
protected:
int choose;
public:
void getdata()
{
cout<<"ON WHICH TIME YOU WANT TO TRAVEL"<<endl;
cout<<"PRESS 1 FOR 11 AM"<<endl;
cout<<"PRESS 2 FOR 10 AM"<<endl;
cout<<"PRESS 3 FOR 9 AM"<<endl;
cin>>choose;
}
void show()
{
if(choose==1)
{
cout<<"|                                                                         "<<endl;
cout<<"|flight mytime 11 AM                                                        "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<"                  GOOD BYE AND HAVE A SAFE JOURNEY                        "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"|                                                                         "<<endl<<
        "|flight mytime 11 AM                                                        "<<endl<<
                         "|_________________________________________________________________________"<<endl<<
"                  GOOD BYE AND HAVE A SAFE JOURNEY                        "<<endl;
}
if(choose==2)
{
cout<<"|                                                                         "<<endl;
cout<<"|flight mytime 10 AM                                                        "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<"                  GOOD BYE AND HAVE A SAFE JOURNEY                        "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"|                                                                         "<<endl<<
        "|flight mytime 10 AM                                                        "<<endl<<
                         "|_________________________________________________________________________"<<endl<<
"                  GOOD BYE AND HAVE A SAFE JOURNEY                        "<<endl;
}
if(choose==3)
{
cout<<"|                                                                         "<<endl;
cout<<"|flight mytime 9 AM                                                        "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<"                  GOOD BYE AND HAVE A SAFE JOURNEY                        "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"|                                                                         "<<endl<<
        "|flight mytime 9 AM                                                        "<<endl<<
                         "|_________________________________________________________________________"<<endl<<
"                  GOOD BYE AND 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 for passenger number::"<<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<<endl;
cout<<"Enter address of passenger:  ";
cin.getline(address,60);
cout<<endl<<endl;
cout<<"Enter the Resevation No. of Ticket"<<endl;
cin.getline(reservation_no,60);
cout<<endl;
cout<<"Enter the current location of passenger(IN CAPITAL LETTERS ONLY):  ";
cin.getline(c_loc,60);
cout<<endl<<endl;
cout<<"Enter the destination of passenger(IN CAPITAL LETTERS ONLY):  ";
cin.getline(dest,60);
cout<<endl<<endl;
system("CLS");
}
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<<"|_________________________________________________________________________"<<endl;
cout<<"|Resevation No. :"<<reservation_no<<"                                     "<<endl;
cout<<"|__________________________________________________________________________"<<endl;
cout<<"|Passenger Information :                                                  "<<endl;
cout<<"|Name :"<<lastname<<"/"<<firstname<<"                                     "<<endl;
cout<<"|                                                                         "<<endl;
cout<<"|Address :"<<address<<"                                                   "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
   cout<<"|flight Information :                                                     "<<endl;
cout<<"|12 aug 2011                                                              "<<endl;
cout<<"|BOING 747                                                                "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<"|Depart :"<<c_loc<<"                                                      "<<endl;
cout<<"|Arrive :"<<dest<<"                                                       "<<endl;
cout<<"|*BAGGAGE allowed 40 Kilos                                                "<<endl;
cout<<"|*contact Airline to Confirm baggage allowance                            "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
 
ofstream outfile("E:\\E_ticket.txt");
        outfile<<"                           AIRLINE TICKET                                 "<<endl<<
"|Ticket No."<<t<<"                                Reference No."<<r<<"\t  "<<endl<<
   "|_________________________________________________________________________"<<endl<<
"|Resevation No. :"<<reservation_no<<"                                     "<<endl<<
  "|__________________________________________________________________________"<<endl<<
   "|Passenger Information :                                                  "<<endl<<
   "|Name :"<<lastname<<"/"<<firstname<<"                                     "<<endl<<
   "|                                                                         "<<endl<<
   "|Address :"<<address<<"                                                   "<<endl<<
   "|_________________________________________________________________________"<<endl<<
       "|flight Information :                                                     "<<endl<<
   "|12 aug 2011                                                              "<<endl<<
   "|BOING 747                                                                "<<endl<<
   "|_________________________________________________________________________"<<endl<<
   "|Depart :"<<c_loc<<"                                                      "<<endl<<
   "|Arrive :"<<dest<<"                                                       "<<endl<<
   "|*BAGGAGE allowed 40 Kilos                                                "<<endl<<
   "|*contact Airline to Confirm baggage allowance                            "<<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"<<endl;;
cin>>option;
system ("cls");
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(strcmp(l_destination[j],c_loc)==0)
{
k++;
}

}
for( int i=0;i<5;i++)
{
if(strcmp(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)<<"*     Press 1 for buisness class    *"<<endl;
cout<<setw(60)<<"*     Press 2 for economy class     *"<<endl;
cout<<setw(60)<<"*************************************"<<endl<<endl<<endl<<endl;

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

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();

system("CLS");
booking::show();
if(ch==1)

{

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

ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"|                                                                         "<<endl<<
        "|Ticket Information:                                                      "<<endl<<
        "|BUISNESS 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<<"__________________________________________________________________________"<<endl;
 cout<<"|     SORRY NO FLIGHT AVAILABLE ON THIS ROUTE RIGHT NOW                   "<<endl;
 cout<<"__________________________________________________________________________"<<endl;

}
}
};

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;

system ("cls");

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(strcmp(i_destination[j],dest)==0)

{

v++;

}

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

{


if(strcmp(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)<<"*     Press 1 for buisness class    *"<<endl;
cout<<setw(60)<<"*     Press 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();



system("CLS");


booking::show();

if(choice==1)

{

cout<<"|                                                                         "<<endl;
cout<<"|Ticket Information:                                                      "<<endl;
cout<<"|BUISNESS 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<<"__________________________________________________________________________"<<endl;
 cout<<"|     SORRY NO FLIGHT AVAILABLE ON THIS ROUTE RIGHT NOW                   "<<endl;
  cout<<"__________________________________________________________________________"<<endl;

}
}
};

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 YOUR CHOICE          *"<<endl;
   cout<<setw(60)<<"*   PRESS 1 FOR LOCAL BOOKING       *"<<endl;
   cout<<setw(60)<<"* PRESS 2 FOR INTERNATIONAL BOOKING *"<<endl;
   cout<<setw(60)<<"*   PRESS 3 FOR SEARCH OF FLIGHTS   *"<<endl;
   cout<<setw(60)<<"*       NOW ENTER YOUR CHOICE:      *"<<endl;
   cout<<setw(60)<<"*************************************"<<endl;
 
   cin>>menu_choice;
 
  system("cls");
 
   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 Press b"<<endl;

  cin>>back;



  system("CLS");

  if (back=='b')

  {

  goto m;

  }

  else

  {

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

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

  }


  break;
 
   case 2:


  p1=&i1;

  p1->getdata();

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

  cin>>back;


  system("CLS");

  if (back=='b')

  {

  goto m;

  }

  else

  {

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

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

  }

  break;
 
   case 3:

  search s1;

  s1.searching();

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

  cin>>back;



  system("CLS");

  if (back=='b')

  {

  goto m;

  }

  else

  {

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

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

  }

  break;
 
}
}
};
void main()
{ SetConsoleTitle(L"AIRWAYS RESERVATION");
system("color 5f");
cout<<"\n\n\n\n\n\n\n\n\n\n\t\t     WELCOME TO AIRWAYS RESERVATION SYSTEM";
Sleep(2500);
system ("cls");
cout<<"\n\n\n\n\n\n\n\t\t          Developed by :";
Sleep(500);
cout<<" Rana Jehanzeb";
Sleep(500);
cout<<"\n\n\n\t\t                         Afraz Ahmad Khan";
Sleep(3000);
system("cls");
main1 m1;
m1.getdata();
}

-->

71 comments:

  1. Thx Man, u r life saver..:)

    ReplyDelete
  2. i try to run this code using code block but its not working, help me please...

    ReplyDelete
    Replies
    1. try to run this code on visual studio. It will work.

      Delete
    2. AOA
      1:void main() void cannot work in main use int.
      2:SetConsoleTitle(L"AIRWAYS RESERVATION");,plz cut this line and compile the pogram your code will run.

      Delete
    3. This comment has been removed by the author.

      Delete
  3. is this using a stack or linear list?

    ReplyDelete
  4. why still error on "using namespace std;" and cant run the coding

    ReplyDelete
    Replies
    1. Which software u are using for coding?
      if u are using 'visual studio' then hopefully this error will be removed.

      Delete
    2. Free Download Complete Working Code Here:

      http://filesafer.com/file/36a72E

      Delete
  5. can you make a plane reservation with double array pls

    ReplyDelete
  6. it can use cancel,delete,insert,change,row
    ->row:x
    reserve
    cancel
    i hope you can help me thanks alot

    ReplyDelete
  7. julius supas , Give Some More Details.

    ReplyDelete
  8. Do you literally copy and paste the entire code? If so I've tried on visual studio 2010 and it comes up with errors

    ReplyDelete
    Replies
    1. give some details about errors...!! it ran perfectly fine on my machine...!!

      Delete
    2. Free Download Complete Working Code Here:

      http://filesafer.com/file/36a72E

      Delete
  9. can u tell me in this code the output is given or not given

    ReplyDelete
    Replies
    1. output depends on what choices you made during the execution of the code.....!!

      Delete
    2. To see video demo please see the video:

      https://www.youtube.com/watch?v=6QagfeZMi0E

      Delete
  10. Sir thank you for this :) so happy bout your system but there's something not working the seat and can you put some price for each destination? if its ok with you sir...thanks in advance

    ReplyDelete
    Replies
    1. its easy bro..!! you can add it yourself...! where you select Class ( economy/business ) after that u can " cout " that for this destination economy class price is this and business class price is this....!!

      Delete
  11. how about the seat sir? how to put seating number?

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Sir could you tell me for what reason SetConsoleTitle is used for?

    ReplyDelete
  14. its not running on borland turbo c++ 4.5...will it run on microsoft visual studio 2012 ultimate..???

    ReplyDelete
    Replies
    1. yes, it will work in visual studio 2012. For demo you can visit following video:

      https://www.youtube.com/watch?v=6QagfeZMi0E

      Delete
  15. yes it should run on visual studio.

    ReplyDelete
    Replies
    1. i cant open the project via visual studio plz help me by providin the steps

      Delete
    2. For demo you can visit following video:

      https://www.youtube.com/watch?v=6QagfeZMi0E

      Delete
  16. okay then let me install it ...will plz provide me the steps what to do after installting vs studio 2012..to run the program...??

    ReplyDelete
  17. can i know. "system ("cls");" what that's mean?

    ReplyDelete
  18. can i know. "system ("cls");" what that's mean?

    ReplyDelete
  19. This comment has been removed by a blog administrator.

    ReplyDelete
  20. will this work on c++ visual studio

    ReplyDelete
  21. can dev c++ read this coding???

    ReplyDelete
    Replies
    1. I haven't tested it in dev c++. But it will work in visual studio.

      Delete
  22. omg it worked on dev c++ you have done a great job very outstanding code it was very helpful for my final project submission :)

    ReplyDelete
    Replies
    1. Wow.. that's for my first project.. You should try to download Code::Blocks .. that may give you better interface and good results ;)

      Delete
    2. dev c++ has given me errors on line 750 saying..void main must return int.

      Delete
    3. then instead of void main write int main and return 0 at the end of main .

      Delete
  23. this helped me in my first project ;) thank you..

    ReplyDelete
  24. what is the data structure used in this

    ReplyDelete
  25. Can any1 plz add the abstraction plz plz..

    ReplyDelete
  26. why there have problem at line 750..which "void int()" have error?

    ReplyDelete
    Replies
    1. Download the complete working code below:

      https://sellfy.com/p/BDJB/

      Delete
  27. This functions shows alots of error and warning....

    ReplyDelete
    Replies
    1. I know that these functions give errors. You can download complete working code below:

      https://sellfy.com/p/BDJB/

      Delete
  28. a a
    dear sir;
    please write this programm in dev c++

    ReplyDelete
  29. i try to run this program but there is warning that for and switch function cant be defined inline how can i correct this

    ReplyDelete
  30. Seems nice information, thanks for sharing this post with us. A online flight booking portal is very help for those who are planning to have a trip to anywhere.

    ReplyDelete
  31. What a awesome information! If you are looking for a flight ticket then book this online flight booking is the perfect option to go.

    ReplyDelete
  32. hi can you please help me by making online air reservation codes in c++... it will be very great if you can

    ReplyDelete
  33. hi can you please help me by making online air reservation codes in c++... it will be very great if you can

    ReplyDelete
  34. hi can you please help me by making online air reservation codes in c++... it will be very great if you can

    ReplyDelete
  35. please help me can't work on the dev++

    ReplyDelete
  36. This piece of code was very beneficial for me, and I gained a lot new knowledge from it which was until unknown to me. Keep blogging and continue updating us with this resourceful guidance.
    Web Design Agency | Website Redesign Company

    ReplyDelete
  37. I wrote int nain instead of void main and write return 0 at the end of main I found error on return 0 .I m using code blocks plz help me

    ReplyDelete
  38. Plz help me out coz the code is not getting complied I'm stucked

    ReplyDelete
  39. buddy i need class diagrame for this system

    ReplyDelete
  40. Do you want to complete your assignment before the deadline? Find the best assignment firm like Student Assignment Help who offer do my assignment for me services to the Australian students at the lowest price.

    ReplyDelete
  41. The Travel Cloud Suite flight booking system streamlines your airline booking process, boosting income. It is made for online travel firms to make it simple for users to book flights, allowing them to search and do so immediately. Users can choose their favourite seat and be informed as the booking progresses.

    ReplyDelete