C++ Hotel Management Project

Here you will get C++ hotel management project. This system provides various options like booking a room, checking customer details, editing or deleting any customer, checking all allotted rooms. The project is developed using two important C++ concepts that are classes and file handling.

C++ Hotel Management Project

Output

C++ Hotel Management Project
C++ Hotel Management Project

76 thoughts on “C++ Hotel Management Project”

    1. hey..
      i want to make project on
      Design and Develop a Power Spread Sheet (PSS) program (much like MS Excel / Lotus 123) that can be used to edit & save data.(in oop n cpp)
      but still i could not get any data.
      please suggest me any site ..

    2. with the modify rooms doesn’t work because it asks me about room no and they will say the room is not vacant or not found so there is no way of modifying rooms

  1. I used this code in C (with modification) but it went in infinite loop in selection menu,
    here it is code.

    do
    {
    printf("ntttt*************");
    printf("ntttt* Welcome *");
    printf("ntttt*************");
    printf("nttt1.Add Patient Data");
    printf("nttt2.View Data");
    printf("nttt3.Modify Data");
    /*printf("nttt4.Delete Data");
    printf("nttt5.Search Data");
    printf("nttt6.Exit"); */
    printf("nntttEnter Your Choice: ";*/
    scanf("%d",&ch);

    switch(ch) // Switch case Starting.
    {
    case 1:
    clrscr();
    petdet();
    break;

    case 2:
    break;

    case 3:break;

    default:
    clrscr();
    printf("Enter Proper Choice.");
    break;
    }
    }while(ch!=3)

  2. Ajit kumar singh

    There is error in the program-
    1.it works on dos box
    2.in void hotel::display() the Records.dat will be Record.dat

  3. hii
    i have use this program but getting run time errors
    can u plzz help me.
    while runnin g the program i put the details and if i want to see that alloted rooms the i get is that the is vacant .
    soo plzz reply as soon as possible

      1. use this in void::rooms() function which will solve your problem
        while(!fin.eof())
        {
        fflush(stdin);
        fin.read((char*)this,sizeof(hotel));
        if(!fin.eof()){
        cout<<"\n\n "<<room_no<<"\t\t"<<name;
        cout<<"\t\t"<<address<<"\t\t"<<phone;
        }
        }

  4. I am creating a project of c++ on hotel management but it doesn’t work properly and creates error.
    please rectify all the errors and make it look proper.

    here it begins

    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    class hotel
    {
    char cmr[30],avl,customer[30],city[20];
    int grp,per,year,mon,days,day,room_no;
    long mobno;

    public: int getname(char cmr[30]);

    void input()
    {
    clrscr();
    textbackground(0);
    textcolor(LIGHTRED);
    gotoxy(32,4);
    cputs(“BOOKING COUNTER”);
    gotoxy(5,8);
    cputs(“Name of the customer :”);
    gotoxy(5,10);
    cputs(“Number Of days to stay :”);
    gotoxy(5,12);
    cputs(“Name of the city :”);
    gotoxy(5,14);
    cputs(“Number of group members:”);
    gotoxy(5,16);
    cputs(“Customer mobile number:”);
    gotoxy(5,18);
    cputs(“Enter the date of arrival:”);
    cout<>per;
    gotoxy(45,12);
    gets(city);
    gotoxy(45,14);
    cin>>grp;
    gotoxy(45,16);
    cin>>mobno;
    gotoxy(45,20);
    cin>>year;
    gotoxy(45,22);
    cin>>mon;
    gotoxy(45,24);
    cin>>day;

    gotoxy(5,30);
    cout<<"\n… Room is booked for "<<customer<<" for "<<per<<" days.";
    strcpy(cmr,customer);
    days=per;
    avl='N';
    }
    void display();

    int getstat(int st);

    };

    void hotel :: display()
    {
    hotel h;
    clrscr();
    getch();

    ifstream fin("hotel.txt",ios::in|ios::binary|ios::app);

    int r,flag;

    cout<>r;

    while(!fin.eof())
    {
    fin.read((char*)&h,sizeof(h));
    if(room_no==r)
    {
    clrscr();
    cout<<"\n\n\t\t\t** CUSTOMER DETAILS **";
    cout<<"\n \t\t\t________________________";
    cout<<"\n\n\nRoom number : "<<room_no;
    cout<<"\n\nName : "<<customer;
    cout<<"\n\nPhone no. : "<<mobno;
    cout<<"\n\nGroup members : "<<grp;
    cout<<"\n\nDays of stay : "<<per;

    flag=1;
    break;
    }

    if(flag==0)
    cout<<"\n\nROOM IS VACANT …..!!!!!";
    cout<<"\n\nPRESS ANY KEY TO CONTINUE :…!!";
    getch();
    fin.close();
    }
    }

    int hotel::getname(char comr[30])
    {
    hotel h;
    int check;

    ifstream fin("hotel.txt",ios::app|ios::in|ios::binary);

    while(!fin.eof())
    {
    fin.read((char*)&h,sizeof(h));
    if(strcmp(comr,cmr)==0)
    {
    check=1;
    break;
    }
    }
    fin.close();
    return (check);
    }

    int hotel::getstat(int st)
    {
    hotel h;
    int flag=0;
    ifstream fin("hotel.txt",ios::in|ios::binary|ios::app);

    while(!fin.eof())
    {
    fin.read((char*)&h,sizeof(h));
    if(st==room_no)
    {
    flag=1;
    break;
    }
    }
    fin.close();
    return(flag);
    }

    void LUX_S();
    void LUX();
    void DLX_S();
    void DLX();
    void GEN();

    void login()
    {
    clrscr() ;
    char pw1, pw2, pw3 ;
    gotoxy(30,12) ;
    cout<<"Enter the password : " ;
    pw1=getch() ;
    cout<<"*" ;
    pw2=getch() ;
    cout<<"*" ;
    pw3=getch() ;
    cout<<"*" ;
    getch();
    if (pw1 == 'S' && pw2 == 'A' && pw3 == 'S')
    {
    return;
    }

    clrscr();

    cout<<" WRONG PASSWORD " ;

    getch() ;
    exit(0) ;
    }

    void pg1()
    {
    cout<<"\n\n\n\n"
    <<"\t\t\t*********************************** \n"
    <<"\t\t\t* COMPUTER SCIENCE PROJECT WORK * \n"
    <<"\t\t\t*********************************** \n"
    <<"\n"
    <<"\t\t\t\1\1\1\1\1\1\1\1 HOTEL MANAGEMENT \1\1\1\1\1\1\1\1\n\n";
    cout<<"\t\t\t \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4 \n"
    <<"\t\t\t \4 WONDERLAND HOTEL \4 \n"
    <<"\t\t\t \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4 \n\n"
    <<"\t\t\t ***OWNERS*** \n"
    <<"\n";
    cout<<"\t\t\t \6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\n"
    <<"\t\t\t NAME:- AAYUSHI JAIN \n"
    <<"\t\t\t SAMIDHA AGARWAL \n"
    <<"\t\t\t SHREYA RAI \n"
    <<"\t\t\t CLASS:- XII – ' B ' \n"
    <<"\t\t\t \6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6\6 \n\n";

    }

    void dll()
    {
    cout<<"\n\n\n\n\n\n\t\tPLEASE WAIT WHILE LOADING THE PROJECT";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(350);
    cout<<".";
    delay(400);

    }

    void main()
    {
    fstream fin,fout;

    int ch;
    char wish,rec;
    hotel h;

    clrscr();

    textcolor(RED);
    textbackground(WHITE);

    login();
    clrscr();
    getch();

    textcolor(YELLOW);
    textbackground(BROWN);

    pg1();
    getch();
    clrscr();

    dll();
    clrscr();
    xyz:

    getch();

    textcolor(LIGHTCYAN);
    textbackground(BLACK);
    clrscr();
    cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
    cout<<"\n======================== Main Menu =======================";
    cout<<"\n _____________ ";
    cout<<"\n——————————————————————————–";
    cout<<"\n++++++++++++++++++++++++++++++++++++++++++++++\n";
    cout<<"++ 1.HOTEL DETAILS AND ROOM NO. ++\n";
    cout<<"++ :2.CUSTOMER INFORMATION ++\n";
    cout<<"++ 3.MODIFY INFORMATION ++\n";
    cout<<"++ :4.BOOK A ROOM ++\n";
    cout<<"++ :5.DETAILS OF ROOM ++\n";
    cout<<"++ 6.CREATE BILL (CHECKOUT) ++\n";
    cout<<"++ :7.DISPLAY ALL CUSTOMERS ++\n";
    cout<<"++ :8.EXIT ++\n";
    cout<<"++++++++++++++++++++++++++++++++++++++++++++++\n";
    cout<>ch;

    if(ch>8)
    {
    clrscr();
    cout<<"\n Wrong choice ….";
    getch();
    goto xyz;
    }

    //********************
    //2.CUSTOMER INFORMATION
    //********************
    if(ch==2)
    {
    int rmno,choice;
    char cust_name[30];

    get:
    getch();
    clrscr();
    getch();

    cout<<"Search customer on the basis of \n";
    cout<<"\5 1.Customer Name \n";
    cout<>choice;

    if(choice>2)
    {
    cout<<"\nOOPs Wrong Entry "<<endl;
    cout<<"Enter again : ";
    getch();
    goto get;
    }

    if(choice==1)
    {
    int check;
    cout<<"Enter customer name : ";
    gets(cust_name);
    fin.open("hotel.txt",ios::in|ios::binary|ios::app);

    check=h.getname(cust_name);

    while(fin.read((char*)&h,sizeof(h)))
    {
    if(check==1)
    h.display();
    else
    cout<<"\n\nCOSTOMER NOT FOUND ";
    }
    }

    if(choice==2)
    {
    int flag;

    cout<>rmno;
    flag= h.getstat(rmno);

    fin.open(“hotel.txt”,ios::in|ios::app|ios::binary);

    while(fin.read((char*)&h,sizeof(h)))
    {
    if(flag==0)
    {
    h.display();
    break;
    }
    }
    }//if(choice==2)
    }//if(ch==2)

    //********************
    //4.BOOK A ROOM
    //********************
    if(ch==4)
    {
    int rmno,flag;

    clrscr();

    fout.open (“hotel.txt”,ios::out|ios::binary|ios::app);

    do
    {
    cout<>rmno;
    flag=h.getstat(rmno);

    if(flag)
    cout<<"\n\nSORRY ROOM ALREADY BOOKED…..!!";
    else
    {
    h.input();
    fout.write((char*)&h,sizeof(h));

    cout<>wish;
    }
    }
    while(wish==’y’||wish==’Y’);

    getch();
    clrscr();
    getch();
    cout<>rec;

    if(rec==’y’||rec==’Y’)
    {
    goto xyz;
    }

    else
    {
    exit(0);
    }
    }

    //**************************
    //5.DETAILS OF ROOM
    //**************************
    if (ch==5)
    {
    int rmno;
    getch();
    clrscr();

    cout<<"\n\n\t\t\tROOM NO. | TYPE "
    <<"\n\n\t\t\t 1 GENERAL "
    <<"\n \t\t\t 2 DELUX "
    <<"\n \t\t\t 3 SUPER DELUX "
    <<"\n \t\t\t 4 LUXURY "
    <<"\n \t\t\t 5 SUPER LUXURY "
    <>rmno;
    getch();
    clrscr();

    if(rmno==1)
    {
    GEN();
    getch();
    clrscr();
    getch();

    cout<>rec;

    if(rec==’y’||rec==’Y’)
    {
    goto xyz;
    }

    else
    {
    exit(0);
    }
    }

    if(rmno==2)
    {
    DLX();
    getch();
    clrscr();
    getch();

    cout<>rec;

    if(rec==’y’||rec==’Y’)
    {
    goto xyz;
    }

    else
    {
    exit(0);
    }
    }

    if(rmno==3)
    {
    DLX_S();
    getch();
    clrscr();
    getch();

    cout<>rec;

    if(rec==’y’||rec==’Y’)
    {
    goto xyz;
    }

    else
    {
    exit(0);
    }
    }

    if(rmno==4)
    {
    LUX();
    getch();
    clrscr();
    getch();

    cout<>rec;

    if(rec==’y’||rec==’Y’)
    {
    goto xyz;
    }

    else
    {
    exit(0);
    }
    }

    if(rmno==5)
    {
    LUX_S();
    getch();
    clrscr();
    getch();

    cout<>rec;

    if(rec==’y’||rec==’Y’)
    {
    goto xyz;
    }

    else
    {
    exit(0);
    }

    }//end of if(rmno==5)

    }//end of if(ch==5)

    //*******************
    //7.DISPLAY ALL
    //*******************
    if(ch==7)
    {
    h.display();
    getch();
    }

    //*******************
    //8.EXIT
    //*******************
    if(ch==8)
    {
    clrscr();
    getch();
    cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS";
    sleep(1);
    clrscr();
    cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS\n\n\n\t\t\t\tPress any key to Exit…….";
    getch();
    exit(0);
    }

    }//End of void main

    void GEN()
    {
    clrscr();
    cout<<"\n FEATURES OF THIS ROOM ";
    cout<<"\n******************************************************************";
    cout< GENERAL “;
    cout< Rs.10000 / day”;
    cout< 2 single beds”;
    cout< 2 adults”;
    cout<<"\n******************************************************************";
    cout<<"\n ADDITIONAL FACILITY ";
    cout<<"\n******************************************************************";
    cout<<"\n\n \6\tGeyser ";
    cout<<"\n\n \6\tTV ";
    cout<<"\n\n \6\tFREE 1 DAY ROOM SERVICE ON BOOKING FOR 5 DAYS";
    cout<<"\n******************************************************************";

    }

    void DLX()
    {
    clrscr();
    cout<<"\n FEATURES OF THIS ROOM ";
    cout<<"\n******************************************************************";
    cout< DELUX “;
    cout< Rs.20000 / day”;
    cout< 2 ( 1 single 1 double )”;
    cout< 4 ( 3 adults 1 child )”;
    cout<<"\n******************************************************************";
    cout<<"\n ADDITIONAL FACILITY ";
    cout<<"\n******************************************************************";
    cout<<"\n\n \6\tCooler ";
    cout<<"\n\n \6\tGeyser ";
    cout<<"\n\n \6\tTV ";
    cout<<"\n\n \6\tFREE 1 DAY ROOM SERVICE ON BOOKING FOR 4 DAYS";
    cout<<"\n******************************************************************";
    }

    void DLX_S()
    {
    clrscr();
    cout<<"\n FEATURES OF THIS ROOM ";
    cout<<"\n******************************************************************";
    cout< DELUX SUIT “;
    cout< Rs.30000 / day”;
    cout< 2 double beds”;
    cout< 4 ( 2 adults & 2 children )”;
    cout<<"\n******************************************************************";
    cout<<"\n ADDITIONAL FACILITY ";
    cout<<"\n******************************************************************";
    cout<<"\n\n \6\tA.C.";
    cout<<"\n\n \6\tGeyser ";
    cout<<"\n\n \6\tTV ";
    cout<<"\n\n \6\tMini Fridge";
    cout<<"\n\n \6\tScenic Balcony";
    cout<<"\n******************************************************************";
    }

    void LUX()
    {
    clrscr();
    cout<<" FEATURES OF THIS ROOM ";
    cout<<"\n******************************************************************";
    cout< LUXURY “;
    cout< Rs.45000 / day”;
    cout< 2 double beds”;
    cout< 4 ( 2 adults & 2 children )”;
    cout<<"\n******************************************************************";
    cout<<"\n ADDITIONAL FACILITY ";
    cout<<"\n******************************************************************";
    cout<<" \n \6\tA.C.";
    cout<<"\n\n \6\tGeyser ";
    cout<<"\n\n \6\tTV ";
    cout<<"\n\n \6\tMini Fridge";
    cout<<"\n\n \6\tBath Tub ";
    cout<<"\n\n \6\tGathering Room";
    cout<<"\n******************************************************************";

    }

    void LUX_S()
    {
    clrscr();
    cout<<" FEATURES OF THIS ROOM ";
    cout<<"\n******************************************************************";
    cout< LUXURY SUIT “;
    cout< Rs.50000 / day”;
    cout< 2 double beds”;
    cout< 4 ( 2 adults & 2 children )”;
    cout<<"\n******************************************************************";
    cout<<"\n ADDITIONAL FACILITY ";
    cout<<"\n******************************************************************";
    cout<<" \n \6\t2 A.C.'s";
    cout<<"\n\n \6\tTV ";
    cout<<"\n\n \6\tMini Fridge";
    cout<<"\n\n \6\tJacuzzi and Geyser";
    cout<<"\n\n \6\tGathering Room with A.C.";
    cout<<"\n\n \6\tFree Wine and Champagne for couples ";
    cout<<"\n******************************************************************";

    }

    please reply as soon as possible

  5. sir kindly tell me how to make hotel management project in c++ using string,functions,pointers,structures only.kindly tell me as soon as possible.

  6. Deepti Vishwakarma

    there is an error which says “MUST USE C++ FOR THE TYPE IOSTREAM”
    please tell me how to rectify it…….

  7. Sir the program runs correctly but when I want to check the allotted rooms the last entry is repeated twice, also I can’t anything but the first entry. And once I edit the first entry the allocation table gets messed up. I need the solution. ASAP.

  8. Pls give me a short descrion of the full project immly.
    Since I am preparing for my practical project based on this.
    Pls send it to my mail today itself
    souravgsgupta1093@gmail. Com

  9. In turbo c++, the program runs correctly but when I want to check the allotted rooms the last entry is repeated twice. And once I edit the first entry the allocation table gets messed up. I need the solution. ASAP.
    In visual studio, There is an error in clrscr, sleep and all expressions connected with colors (textbackground, textcolor, RED, C80, WHITE)

  10. Sir I want a library management system code
    As soon as possible . please use DEV or visual studio
    If it is possible

  11. I am getting logical error…after execution of program i’m not getting proper answer or output
    So please help me

  12. There is literally no error . Only just semicolon error in the display function and some bracket problem. Otherwise the program is ok . It could be more good if it had the the prices of room and like it might ask to write ur pno again if the Pno is not 10 digit number

  13. Does anyone here know to do c++ programme looping coding for accesscard for each level of an appartment.For example, there are 16 level in a appartment

  14. Sir, I am a student in grade 8, i have an interest to learn c++ since it is being taught to us in school. So, i was seeing a youtube video just to understand the code and in the video they showed that to make games with c++ you first need to make a file with visual basic. And luckily i had visual basic downloaded in my device ,so i completed the code in visual basic and when i debugged it there were errors saying “dir” is unidentified. I used “dir=STOP” once in the code. I am struggling to understand what the error is, i was browsing through the internet for some reference and i found this website so, i saw that you answer some comments.I hope you can help me in some way.

Leave a Comment

Your email address will not be published. Required fields are marked *