Javatpoint Logo
Javatpoint Logo

Hotel Management in C++

This article contains a C++ hotel management project. This system offers a number of choices, like reserving a room, reviewing customer information, changing or removing any client, and seeing all rooms that have been assigned. Two key C++ concepts-classes and file handling-are used in the project's development.

Features of Hotel Management System in C++

  • Manage Rooms
  • Check-In
  • Get available rooms
  • Search customer
  • Check-out room
  • Get guest summary report

Program Breakdown

We will going to include all the necessary library files to avoid any kind of error and pre defining max to be 100.

We have created a class for customer having variables like name of size 100, address of size 100, phone of character up to 12, from date of size 20, to_date of size 20, a float payment_advance variable and a booking_id of type int.

We have declared a class room having the variables like type, stype, ac, roomNumber of type int, rent of type int and status of type int. We have created a object of the customer class cust.

We have declared rooms[max] of room class as global and count as 0;

In the function addroom, an object of class room is created which will be responsible to add the rooms according to customer need and will ask for type AC or NOT then ask for comfort and size of room S or B and daily rent which we will going to set as per need. Rooms added successfully.

This function search room will help in finding existed room if available. The customer will enter the room number, if the room is found it will show the details of the room.

This function will display the rooms only when the customer will enter the room number and chose the type AC or not and comfort and type size etc.

This will going to be the class for hotel management having options like check-in, available rooms, search for a customer, check out and getting the summary report.

The function above getsummary will get us the summary of a existed customer if present any and we can add the summary as well. It will ask for customer first name, room number, address and phone number.

If a customer wants to make a reservation then this code will come in action. The customer will enter the room number; if that room is booked then system will flag a text showing room is already booked. If the room was not booked the system will ask for booking id, customer name, ask for enter the address, enter the phone number, enter the date you want to take the room and for enter the advance payment. Then the system will flag a text showing Customer checked in successfully.

The above function will show the available rooms, if that room found to be reserved system shows a flag stating that all rooms are reserved.

The above peace of code will go to search for a customer. The user will enter the customer name and if the customer doesn't exist it will show person not found.

The above peace of code is used to generate the bill of a customer.

The above peace of code is used to manage the rooms like, adding rooms or search room or back to menu.

Program for Hotel Management System


######## Hotel Management #########
1. Manage Rooms
2. Check-In Room
3. Available Rooms
4. Search Customer
5. Check-Out Room
6. Guest Summary Report
7. Exit
//when option 1
Enter Option:
### Manage Rooms ###
1. Add Room
2. Search Room
3. Back to Main Menu
Enter Option: 1
Enter Room Number: 1
Type AC/Non-AC (A/N) : A
Type Comfort (S/N) : S
Type Size (B/S) : B
Daily Rent : 1000
 Room Added Successfully!
### Manage Rooms ###
1. Add Room
2. Search Room
3. Back to Main Menu

Enter Option: 2
Enter room number: 1
Room Details
Room is available
Room Number:    1
Type AC/Non-AC (A/N) A
Type Comfort (S/N) S
Type Size (B/S) B
Rent: 1000
//when option 2 check in room
Enter Phone: 456378654
Enter From Date: 30/07/2022
Enter to  Date: 02/08/2022
Enter Advance Payment: 500
 Customer Checked-in Successfully..
//when search for customer
Enter Option: 4
Enter Customer Name: Rohit
Customer Name: Rohit
Room Number: 1

Press enter for next record
//when option chosen for check out
Enter Option: 5
Enter Room Number : 1
Enter Number of Days:   10

        ######## CheckOut Details ########

Customer Name : Rohit
Room Number : 1
Address : Delhi
Phone : 456378654
Total Amount Due : 10000 /
Advance Paid: 500 /
*** Total Payable: 9500/ only

Next TopicPacman Game in C++

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA