In this tutorial, we’ll code the Airline Reservation System Project in C++ in a very easy and understandable way. The Airline Reservation System can be coded using many programming languages, But in this project, we are going to use C++ language as per the demand of students.
Table of Contents
What is Airline Reservation System?
As the name suggests Airline Reservation System is software that handles the entire booking data of the Flights. It is fully based on the concept of reserving flight tickets for various destinations. Previously the task of handling the tickets at a time was very difficult, so there was a need for software that can handle all Airline Reservation System.
Therefore the Airline Reservation System was designed. After the release of this system, the stress and workload of the employee were absolutely finished. It was also time-wasting for the travelers to book a Ticket previously. But now it hardly takes 10 to 15 minutes to book a ticket wherever the passenger is.
Features of Airline Reservation System Project in C++
- This project can be handled by anyone. Admin rights are not given to anyone.
- Reservation can be done in a very short period of time.
- This project also has the facility of canceling the reservation.
- Passengers can see the reservations of each and every seat on any flight.
- If a passenger changes their mind and wants to cancel the reservation then they can cancel their reservation any time.
- This software provides can also show the list of reservations done by the passengers.
- Passengers can also be able to see the status of their reservations.
Modules of Airline Reservation System Project in C++
- Make Reservation.
- Cancel Reservation.
- Search Passenger.
- Change Reservation.
- Print a List.
- Print Status Report.
- Quit.
Working of Project
In the zip file, you’ll get an executable .exe file where you can directly run the entire project manually. Now we’ll see the working of the entire application with an explanation.
After running the executable file from the project zip or running the project from the compiler you will directly see the following main screen:
Here we’ve displayed the menu options such as make a reservation, cancel a reservation, search passenger, change a reservation, print a list, print status report, and quit. If the passenger wants to make a reservation for a flight then he must choose option 1. If the passenger’s mind changed and wants to cancel the reservation then he must choose option 2. By choosing option 3 the passenger can search the passenger if he wants to check who has booked a particular seat.
If the passenger wants to change the seat then he must choose option 4. The passenger can print a list of passengers by choosing option number 5. If passengers want to check the status of their reservation then they must choose option 5. And the last menu option 6 is to exit the complete project.
Now we’ll see each and every option in detail.
Make Reservation:
By choosing menu option number 1 passengers will be able to make a fresh reservation for any particular flight. During the reservation software will ask for some basic details which are as follows:
- First name of a passenger.
- Last name of a passenger.
- Id number.
- Phone number.
- Seat number which you want to book.
- Which type of food do you need during the travel i.e veg or non-veg.
After entering the above details the unique reservation id will be generated for your booking. If the reservation is done successfully then the process completed message will be displayed at the bottom of the project. If the user is trying to book the seat which is already reserved then the software will show the message “Seat is already reserved please choose another seat number from below”. So you’ve to enter the seat number again from the given list then only the seat will be reserved successfully.
Cancel Reservation:
Sometimes what happens passengers’ mind changes and they try to cancel the reservation because of some urgency or personal reason. So in such a situation, he’ll be able to cancel the reservation anytime by choosing option 2 from the options menu.
To cancel the reservation you must have your reservation number generated by software during the reservation. Because software asks reservation number during the cancellation. If you forgot the reservation number then you’ll not be able to cancel the tickets.
When you choose menu option 2, then you’ve to enter the reservation number then the software will fetch the passenger details using this reservation number. This reservation number is uniquely generated and confidential that’s why after entering the reservation number, your reservation will be canceled quickly.
Search Passenger:
With the help of this option, passengers will be able to see the detail of a particular person. The detail such as first name, last name, Id, phone number, seat number, and the reservation number will be displayed.
Change Reservation:
By choosing menu option number 4 you’ll be able to change the reservation or edit the existing reservation. Sometimes the passengers want to change their seat number because they want to sit near the window or the couple wants seats near each other. In such a situation, passenger wants to change the location of their seat by editing the reservation.
After choosing menu option 4, the software asks for your existing seat number first. After entering the existing seat number the software displays the list of available seats which you can choose. So here you’ve to choose a suitable seat and enter its number then the software will allocate the chosen seat to you.
If you enter the seat number which is already chosen by others then the software will crash and the project will be exited.
Print a List:
This software provides a facility for the passengers where they can print the list of all the reservations done by the passengers. If the user wants to check which seats are available and which seats are actually booked then in such case this list will help the user to make a reservation quickly.
Print Status Report:
By choosing option number 6 the user will be able to print the status report of the airline reservation system project in C++. In this status, the reporting software will show the details like how many seats are reserved and how many users have canceled the reservations.
With the help of these details, the user will decide whether this flight will be canceled or suitable for travel.
Quit:
By choosing the 7th option the Airline reservation system project in c++ will be closed.
Download the Project
By clicking the following button you can download the zip file of the project which consists of the source code and the executable .exe file.
If you need a quick project code then please read the following code:
Source Code of Airline Reservation System Project in C++
This project consists of two c++ files and one header file, you’ll get all these 3 files from the zip file.
- Airline Reservation System.cpp
//Learnprogramo - Programming made simple #include <iostream> #include <cstdlib> #include "learnprogramo.cpp" using namespace std; int main() { system("CLS"); cout<<"\n \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"<<endl; cout << "\t AIRLINE RESERVATION SYSTEM \n"; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"<<endl; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd MENU OPTIONS \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"<<endl; menu(); seat_fill(); return 0; }
2. learnprogramo.cpp
//Learnprogramo - programming made simple #include <iostream> #include <iomanip> #include "learnprogramo.h" using namespace std; int reserve = 999; int seat[size]; void seat_fill() { for (int i = 0; i < size; i++) { seat[i] = 0; } } bool taken=false; bool seat_no(int y) { for (int i = 0; i < size; i++ ) { if( seat[i] == -1 ) { taken=true; cout << "The seat is taken already. \n"; cout << "Please choose another seat number from below."<<endl; int j = 1; while ( j < size+1 ) { if ( seat[j-1] == -1) j++; else { cout <<"|" << j << "|"; if ( j%10 == 0 ) cout << endl; j++; } } } } } void menu() { char choice; do{ cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<"\t Make Reservation ------ [1] \n"; cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<"\t Cancel Reservation ------ [2] \n "; cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<"\t Search Passenger ------ [3] \n"; cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<"\t Change Reservation ------ [4] \n"; cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<"\t Print a list ------ [5] \n"; cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<"\t Print status Report ------ [6] \n "; cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<"\t Quit ------ [7] \n "; cout <<"\t \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd \n"; cout <<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; cout <<" Option : "; cin >> choice; choice = ((int)(choice)-48); switch (choice) { case 1: system("CLS"); bluesky.make_reservation(); break; case 2: system("CLS"); bluesky.cancel_reservation(); break; case 3: system("CLS"); bluesky.search_passenger(); break; case 4: system("CLS"); bluesky.change_reservation(); break; case 5: system("CLS"); bluesky.print_list(); break; case 6: system("CLS"); bluesky.print_report(); break; case 7: cout << "\n\nThank you come again\n\n\n"; break; default: cout<<" Don't be like a DORK!!! \n\n"; break; } // Ending case loop. cout<<"\n PROCESS COMPLETED...\n\n"; cin.get(); if(cin.get()=='\n') system("CLS"); cout<<"\n \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"<<endl; cout << "\t AIRLINE RESERVATION SYSTEM \n"; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"<<endl; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd MENU OPTIONS \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"<<endl; }while(choice != 7 ); } airlines::airlines() { start = NULL; } void airlines:: make_reservation() { int meal_choice, x; temp = new node; cout<<"\n\n Enter First Name of person: "; cin>>temp->fname; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; cout<<" Enter Last Name of Person: "; cin>>temp->lname; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; cout<<" Enter ID of the person: "; cin>>temp->ID; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; cout<<" Enter Phone Number of Person: "; cin>>temp->phone_num; cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; do{ cout << " Please Enter the Seat Number: "; cin>>x; while(x>size){ cout<<" Try again:: "; cin >>x; } cout<<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; if((seat[x-1])>-1) taken = false; else seat_no(x); seat[x-1] = -1; temp->seat_num = x; }while(taken==true); cout << " Please Enter Your Menu Preference from below: \n\n"; cout << " Veg ..... '1'\n"; cout << " Non-Veg ..... '2'\n"; cout << " No meal ..... '3'\n\n"; cout <<" Your Choice :: "; cin >> meal_choice; while(meal_choice>3 || meal_choice<1){ cout<<" Try Again:: "; cin>>meal_choice; } if (meal_choice == 1) temp->menu = "veg"; else if (meal_choice == 2) temp->menu = "Non-Veg"; else temp->menu = "No meal"; reserve++; temp->reserve_num=reserve; cout <<"\n \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; cout <<" YOUR RESERVATION NUMBER IS :: " << reserve << "\n"; cout <<" \xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\n"; temp->next = NULL; if(start == NULL) start = temp; else { temp2 = start; while (temp2->next != NULL) { temp2 = temp2->next; } temp2->next = temp; } } int cancel=0; void airlines:: cancel_reservation() { int num; cout << "Please Enter your reservation Number here: "; cin >> num; node *cur = start; if(cur!=NULL) { if ( start->reserve_num == num ) { node *del = start; start = start->next; delete del; seat[0] = 0; cancel++; return; } else { node *pre, *cur; pre = start; cur = start->next; while(cur != NULL) { if ( cur->reserve_num == num ) break; pre = cur; cur = cur->next; } seat[cur->seat_num-1] = 0; if (cur != NULL ) pre->next = cur->next; } cancel++; } else { cout<<"!!! *** Nothing to delete or invalid entry *** !!! \n"<<endl; } } void airlines:: search_passenger() { string fakename; cout << "Please enter your first name here: "; cin >> fakename; node *cur = start; while (cur != NULL) { if (cur->fname == fakename) { cout << "First Name : " << cur->fname << endl; cout << "Last Name : " << cur->lname << endl; cout << "ID " << cur->ID << endl; cout << "Phone number: " << cur->phone_num << endl; cout << "Seat Number: " << cur->seat_num << endl; cout << "Reservation No. " << cur->reserve_num<< endl; return; } cur = cur->next; } cout << " Sorry!!! NOT FOUND \n\n"; } void airlines:: change_reservation() { int option , next_seat; cout << " Please enter your seat number: "; cin >> option; node *cur; cur = start; while(cur != NULL) { if ( cur->seat_num == option ) break; cur = cur->next; } cout << "Please choose another seat number from below."; int j = 1; while ( j < size+1 ) { if ( seat[j-1] == -1) j++; else { cout <<"| " << j << "|"; if ( j%10 == 0 ) cout << endl; j++; } } cin >> next_seat; seat[cur->seat_num-1]=0; cur->seat_num = next_seat; seat[next_seat-1] = -1; } void airlines:: print_list() { temp=start; if(temp == NULL) cout<<" End of lists"<<endl; else { int cnt = 1; cout << "\tNumber\t First Name\t Last Name\t ID\t"; cout << "Phone Number\t Seat Number\t Reservation No\t Menu\n"; while(temp != NULL) { cout << "\t" << cnt <<setw(15); cout << temp->fname <<setw(15); cout << temp->lname << setw(12); cout << temp->ID << setw(12); cout << temp->phone_num <<setw(15); cout << temp->seat_num <<setw(15); cout << temp->reserve_num <<setw(12); cout << temp->menu << "\n"; temp=temp->next; cnt++; } cout << "\n\n"; } } void airlines:: print_report() { int count = 0; for (int i =0; i < size; i++ ) { if (seat[i] == -1) count++; } cout<<"The number of reserved seats are: " << count <<endl; cout<<"The number of cancellations are: " << cancel <<endl; }
3. learnprogramo.h (header file) you can change the header file name
//Learnprogramo - programming made simple #include<iostream> using namespace std; #define size 100 class airlines { public: airlines(); void main_menu(); void make_reservation(); void cancel_reservation(); void search_passenger(); void change_reservation(); void print_list(); void print_report(); private: struct node { string fname, lname, ID, phone_num, menu; int reserve_num, seat_num; node *next; }; node *start; node *temp, *temp2; }bluesky;
Steps to Run the Project
- Extract the Downloaded Zip file or copy the above source code of the airline reservation system project in c++.
- Open the file using C++ Compiler such as Dev C++ etc.
- Paste the source code and save the file in any of the computer locations.
- Compile the project using compile option.
- There is no error in the source code, if found then correct it.
- Now run the project.
- The executable .exe file will be generated in the location you choose.
Summary:
In this way, we’ve created and executed the Airline Reservation System Project in C++. If you have any doubt then please feel free to contact us. We’ll solve your doubts as soon as possible.
Thanks and HAPPY CODING :)
Also Read:
- 50+ Interesting C Projects.
- 25+ C++ Projects.
- Library Management System Project in C++.
- Vaccine Management System Project in C++.
- Railway Reservation System Project in C++.
- Bus Reservation System Project in C++.
- Medical Store Management System Project in C++.