Home » C++ » C++ Projects » Project on Hotel Management
C++ Project on Hotel Management
Project for C++ beginners, it covers macros, class, objects, array, functions, loops, structure. On execution of this code users get a menu with 7 points 1 to 7 and then program runs according to user selection. There is output at the end of this page, which is captured on g++ compiler. Users of CppBuzz are allowed to copy & modify the code according to their need. If you need any project, feel free to contact us with project details.
Features
- Manage Rooms
- Check-In
- Get available rooms
- Search customer
- Check-out room
- Get guest summary report
Source Code
#include #include #define max 100 using namespace std; //Class Customer class Customer { public: char name[100]; char address[100]; char phone[12]; char from_date[20]; char to_date[20]; float payment_advance; int booking_id; }; class Room { public: char type; char stype; char ac; int roomNumber; int rent; int status; class Customer cust; class Room addRoom(int); void searchRoom(int); void deleteRoom(int); void displayRoom(Room); }; //Global Declarations class Room rooms[max]; int count=0; Room Room::addRoom(int rno) { class Room room; room.roomNumber=rno; cout<<"\nType AC/Non-AC (A/N) : "; cin>>room.ac; cout<<"\nType Comfort (S/N) : "; cin>>room.type; cout<<"\nType Size (B/S) : "; cin>>room.stype; cout<<"\nDaily Rent : "; cin>>room.rent; room.status=0; cout<<"\n Room Added Successfully!"; return room; } void Room::searchRoom(int rno) { int i,found=0; for(i=0;i >rno; for(i=0;i >rooms[i].cust.booking_id; cout<<"\nEnter Customer Name (First Name): "; cin>>rooms[i].cust.name; cout<<"\nEnter Address (only city): "; cin>>rooms[i].cust.address; cout<<"\nEnter Phone: "; cin>>rooms[i].cust.phone; cout<<"\nEnter From Date: "; cin>>rooms[i].cust.from_date; cout<<"\nEnter to Date: "; cin>>rooms[i].cust.to_date; cout<<"\nEnter Advance Payment: "; cin>>rooms[i].cust.payment_advance; rooms[i].status=1; cout<<"\n Customer Checked-in Successfully.."; } } //hotel management shows available rooms void HotelMgnt::getAvailRoom() { int i,found=0; for(i=0;i >days; billAmount=days * rooms[i].rent; cout<<"\n\t######## CheckOut Details ########\n"; cout<<"\nCustomer Name : "< >opt; //switch statement switch(opt) { case 1: cout<<"\nEnter Room Number: "; cin>>rno; i=0; for(i=0;i >rno; room.searchRoom(rno); break; case 3: //nothing to do break; default: cout<<"\nPlease Enter correct option"; break; } }while(opt!=3); } using namespace std; int main() { class HotelMgnt hm; int i,j,opt,rno; char ch; char pname[100]; do { cout<<"######## Hotel Management #########\n"; cout<<"\n1. Manage Rooms"; cout<<"\n2. Check-In Room"; cout<<"\n3. Available Rooms"; cout<<"\n4. Search Customer"; cout<<"\n5. Check-Out Room"; cout<<"\n6. Guest Summary Report"; cout<<"\n7. Exit"; cout<<"\n\nEnter Option: "; cin>>opt; switch(opt) { case 1: manageRooms(); break; case 2: if(count==0) { cout<<"\nRooms data is not available.\nPlease add the rooms first."; } else hm.checkIn(); break; case 3: if(count==0) { cout<<"\nRooms data is not available.\nPlease add the rooms first."; } else hm.getAvailRoom(); break; case 4: if(count==0) { cout<<"\nRooms are not available.\nPlease add the rooms first."; } else { cout<<"Enter Customer Name: "; cin>>pname; hm.searchCustomer(pname); } break; case 5: if(count==0) { cout<<"\nRooms are not available.\nPlease add the rooms first."; } else { cout<<"Enter Room Number : "; cin>>rno; hm.checkOut(rno); } break; case 6: hm.guestSummaryReport(); break; case 7: cout<<"\nTHANK YOU! FOR USING SOFTWARE\n"; break; default: cout<<"\nPlease Enter correct option"; break; } }while(opt!=7); }