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

19 thoughts on “C++ Hotel Management Project

    1. Nida Zia

      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 ..

      Reply
  1. Noldok

    Problem with: clrscr, sleep and all expressions connected with colors (textbackground, textcolor, RED, C80, WHITE)…

    Reply
  2. unnat_rocks

    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)

    Reply
  3. 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

    Reply
  4. anurag thakur

    this programming code has got many error ………..
    and it is not showing desired output

    Reply
  5. Himanshu Singh

    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

    Reply
  6. Pratik

    Give a function to find non allocated rooms in a hotel management project in c++

    Reply
  7. samidha agarwal

    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

    Reply

Leave a Reply

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