C + + final course design - hotel room management system (detailed report + source code + detailed notes) (add "25 +" C++&&C language final course design system download address)

Keywords: C C++

Hotel room management system report

catalogue

Hotel room management system report

1, Description

2, Design idea and overall design

3, Detailed design

1. Function realization of main function

2. Realization of reservation function

3,   Realization of check-in function

4,   Realization of check-out settlement function

5. Realization of information query function

4, System source code

5, Screenshot of operation results

1. System login interface

2. Reservation function

3. Check in function

4. Check out function

5. Query function

6, Attachment / download address

be careful:  

Download address of the system:

C & C + + final course design

C language final course design

1, Description

hello everyone! I'm Xiao Yuzai. Today I'd like to share with you the C + + final course design - hotel room management system. This program is written in C + +. It realizes the reservation management, check-in management, settlement registration management, information query management, etc. of hotel rooms. It is a good reference for learning C + + programs. This system runs in the command line window and has no visual interface, MFC class library is also not used. If friends use it to learn or do C + + final course design homework, it must be OK. I'll share some with you. In addition, the download address of "25 +" C + + & & C language final course design (super detailed) is attached at the end of this blog. I will publish it in the next period of time. If you need friends in a hurry, please leave a message in the comment area. I will refer to it and publish the required articles at the first time!!!

Especially remember: the user name and password entered after running the program are: 123

If you have any questions or comments, please contact me immediately:  

CSDN:Little baby_ CSDN bloghttps://blog.csdn.net/m0_46843484?spm=1000.2115.3001.5343

Copyright notice: unless otherwise stated, the copyright of all articles on this blog belongs to the author. Reprint please indicate the source!  

2, Design idea and overall design

Through the study of C + + course, I learned its advanced object-oriented characteristics. I decided to use it to implement a hotel room management system and simulate the operation of an actual hotel room system. Below, I will explain the implementation idea of this system.

As a hotel guest room management system, it must involve guest room objects, customer objects and other entities. I have set up 80 rooms in this system, of which the rooms are divided into four levels. The price of each level is different. You can get the level of the room through the room number. Then there is the problem of room allocation, that is, when a customer requests to book a room or check in, my program can find a room that has not been booked and a vacant room that has not been checked in according to the level of occupancy required by the user.

After starting the program, it runs from the Main function on the Windows platform. The program first calls initial_ The room function initializes the information of 80 rooms, including room number, room grade, room price and room status. The room number is directly related to the room grade. As long as the room number is known, the grade of the room can be calculated. When the room status is initialized, it is equal to 0, indicating that the room is neither reserved nor checked in. Then calling the welcome function, taking into account the security of a hotel management system, the personnel who operate the system also require authentication. In this function, operating system is required only by entering the correct username and password. After passing the login authentication, you enter the hotel management system. Here, the system displays an operation menu to the operator, such as 1 - > Room reservation   2 - > check in   3 - > check out   4 - > query, when the operator selects different numbers, different functions can be realized.

3, Detailed design

1. Function realization of main function

  Main function code implementation:

void main()			//The program entry starts from here
{
 char choice='1';
 initial_room();	//Initialize the information of 80 rooms in four levels
 welcome();			//Verify that the user logs in and displays the welcome message successfully
 
 while(choice=='1')
 {
  enter();   //Perform different functions according to the user's choice
  cout<<endl;
  cout<<"To continue using the system, press\"1\",To exit, press\"2\"!  ";
  cin>>choice;
  cout<<endl;
 }
}

2. Realization of reservation function

As a hotel management system, customers can book rooms in the hotel in advance, and the operator can query the rooms suitable for customers according to the needs of users. In this system, this function is in book_ The flow chart is shown in the following figure. First, construct a customer object, then set the number of days for the customer to book a room, set the standard for the customer to book a room, go to the corresponding standard room according to the customer release standard required by the user to find a room that is neither reserved nor checked in, and then modify the state of the housing object structure to the reserved state, At the same time, the reservation room number attribute of the customer object and the housing cost are calculated and displayed on the interface. Finally, the number of housing customers is added by 1.

  Reservation function code implementation:

void book_room()
{
 customer[i]=new Customer;
 int room_standard,day;
 cout<<"Please select the standard of reservation:\n"; 
 cout<<"1.Single room/150 yuan per day\n2.Double room/200 yuan per day\n3.standard room/300 yuan per day\n4.presidential suite/600 yuan per day\n"; 
 cin>>room_standard; 
 cout<<"Please enter the scheduled days\n"; 
 cin>>day; 
 customer[i]->set_day(day);
 switch(room_standard) 
 { 
  int n;
 case 1:
  cout<<"The total cost of housing is: "<<day*150<<"element\n";		//Calculate housing costs
  for(n=0;n<20;n++)			//Find a free room from the first level of rooms
  {
   if(room[n].state==0)		//state=0 means the house is not booked
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break; 
 case 2:
  cout<<"The total cost of housing is: "<<day*200<<" element\n"; 
  for(n=20;n<40;n++)
  {
   if(room[n].state==0)
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break; 
 case 3:
  cout<<"The total cost of housing is: "<<day*300<<" element\n"; 
  for(n=40;n<60;n++)
  {
   if(room[n].state==0)
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break; 
 case 4:
  cout<<"The total cost of housing is: "<<day*600<<"element\n"; 
  for(n=60;n<80;n++)
  {
   if(room[n].state==0)
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break;   
 }  
 i++;  //The number of customers in the house plus 1
}

3,   Realization of check-in function

This function is in the function check_ The name of ID number is In, and if the room is ordered, the customer name and ID number are required. Then, the customer who looks for this name and ID card number is found in all the customers. If the match is made, the housing number is obtained, and the housing standard is calculated according to the housing number. Then, the room fee to be paid by the customer is calculated according to the number of days the customer requires to book the house and the price of the housing standard, and displayed on the interface. At this time, the operator charges the customer, sets the customer's housing fee attribute, and changes the state of the house to the occupancy state (State=2); If the customer does not have time to book a room first, the function of finding an empty room first and then checking in can be realized here. Like the function of booking a room, first establish a customer object to represent the customer who is about to check in, then set the check-in days, select the housing standard, query an empty room according to the housing standard, and then set the customer's housing room attribute, At the same time, directly modify the status of the room to the checked in status, calculate the room fee to be charged, directly implement the charge, and then add 1 to the number of customers.

  Check in code implementation:

void check_in()
{
    char name1[10],id1[19];
 int ding_or_no,prepaid;
 cout<<"Is it time for the customer to make a reservation? (1->Ordered 2->No order) ";
 cin>>ding_or_no;
 if(ding_or_no==1)
 {
  cout<<"Please enter the customer's name:"<<endl;
  cin>>name1;
  cout<<"Please enter the ID number of the customer.:"<<endl;
  cin>>id1;
  for(int j=0;j<=i;j++)
  {
   if((strcmp(customer[j]->get_name(),name1)==0)&&(strcmp(customer[j]->get_ID(),id1)==0))  //Find the reservation information of the customer
   {
    int num=customer[j]->get_room_number();  //Get the room number of the reservation
    cout<<"customer"<<name1<<"Stay in our hotel today! Room number is: "<<num<<endl;
    switch(num/100)
    {
    case 6:
     prepaid=customer[j]->get_day()*150;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl; //Start charging
     room[num%100-1].state=2;                  //Change room status to check-in status
     break;
    case 7:
     prepaid=customer[j]->get_day()*200;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl;
     room[19+num%100].state=2;
     break;
    case 8:
     prepaid=customer[j]->get_day()*300;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl;
     room[39+num%100].state=2;
     break;
    case 9:
     prepaid=customer[j]->get_day()*600;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl;
     room[59+num%100].state=2;
     break;
     
    }
    break;
   } 
  }
  
  
 } 
 else
 {
  customer[i]=new Customer;
  int room_standard,day;
  cout<<"Please select the standard of reservation:\n"; 
  cout<<"1.Single room/150 yuan per day\n2.Double room/200 yuan per day\n3.standard room/300 yuan per day\n4.presidential suite/600 yuan per day\n"; 
  cin>>room_standard; 
  cout<<"Please enter the number of days of stay\n"; 
  cin>>day; 
  customer[i]->set_day(day);
  switch(room_standard) 
  { 
   int n;
  case 1:
   prepaid=day*150;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=0;n<20;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break; 
  case 2:
   prepaid=day*200;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=20;n<40;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break; 
  case 3:
   prepaid=day*300;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=40;n<60;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break; 
  case 4:
   prepaid=day*600;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=60;n<80;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break;   
  }  
  i++;
 }
}

4,   Realization of check-out settlement function

Concise: this function is in the function check_ In Out, the program first calculates the customer's consumption cost according to the name and ID number of the check-out customer and the number of days of customer input. This program uses the Swithch (standard) function to judge whether to refund the customer or supplement the customer's housing expenses according to the customer's room number and the amount of the customer's prepaid room fee.

Check out settlement function code implementation:

void check_out()
{
 char name2[10],id2[19];
 int standard,j,room_number,day1,day2,day;
 cout<<"Please enter the name and ID number of the customer to check out.:\n";
 cin>>name2>>id2; 
 cout<<"Please enter the actual number of days the customer lives:\n"; 
 cin>>day2; 
 for(j=0;j<i;j++)
 {
  if((strcmp(customer[j]->get_name(),name2)==0)&&(strcmp(customer[j]->get_ID(),id2)==0))
  {
   room_number=customer[j]->get_room_number();
   standard=room_number/100; 
   day1=customer[j]->get_day();
   day=day1-day2;
   switch(standard) 
   {
   case 6: 
    cout<<"What's the customer's room number"<<room_number<<" :Single room,150 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*150<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*150<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*150<<" Yuan integer!\n";
    break; 
   case 7:
    cout<<"What's the customer's room number"<<room_number<<" :Single room,200 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*200<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*200<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*200<<" Yuan integer!\n";
    break; 
   case 8:
    cout<<"What's the customer's room number"<<room_number<<" :Single room,300 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*300<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*300<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*300<<" Yuan integer!\n";
    break; 
   case 9:
    cout<<"What's the customer's room number"<<room_number<<" :Single room,600 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*600<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*600<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*600<<" Yuan integer!\n";
    break; 
   }
   cout<<endl;
   cout<<"Check out accounting is clear,Press 1: ";
   char account;
   cin>>account;
   if(account=='1')
   {
    for(int k=0;k<80;k++)
    {
     if(room[k].number==customer[j]->get_room_number()) 
      room[k].state=0;
    }
    i--;
    for(;j<i;j++)
    {
     customer[j]=customer[j+1];
    }
    delete customer[i];
   }
  }
 } 
}

5. Realization of information query function

Concise: this function is implemented in the function Void inquire(). The information query is divided into room information query 1 and customer information query 2. The room information query will list: those rooms have not been reserved or checked in; Those rooms are reserved and those rooms are occupied; For customer information enquiries, it is divided into 1 categories: name inquiry, press by 2 and ID card enquiry. Enter the customer's name and ID number respectively.

Information query function code implementation:

void inquire()
{
 char inquire_choice;
 cout<<"For room information query, press 1, For customer information query, press 2: "<<endl;
 cin>>inquire_choice;
    if(inquire_choice=='1')
 {
  int j,k=0;
  cout<<endl;
  cout<<"The following rooms have not been reserved or checked in:"<<endl;
  for(j=0;j<80;j++)
  {
   if(room[j].state==0)
   {
    if(k%10==0) cout<<endl;
    cout<<room[j].number<<'\t';
    k++;
   }
  }
  cout<<endl;
  cout<<endl;
  k=0;
  cout<<"The following rooms are reserved:"<<endl;
  for(j=0;j<80;j++)
  {
   if(room[j].state==1)
   {
    if(k%10==0) cout<<endl;
    cout<<room[j].number<<'\t';
    k++;
   }
  }
  k=0;
  cout<<endl;
  cout<<endl;
  cout<<"The following rooms are occupied:"<<endl;
  for(j=0;j<80;j++)
  {
   if(room[j].state==2)
   {
    if(k%10==0) cout<<endl;
    cout<<room[j].number<<'\t';
    k++;
   }
  }
  cout<<endl;
  cout<<endl;
 }
 else if(inquire_choice=='2')
 {
  cout<<"To query by name, press 1, For inquiry by ID card, please press 2: "<<endl;
  char inquire_choice;
  cin>>inquire_choice;
  if(inquire_choice=='1')
  {
   char name3[10];
   cout<<"Please enter the customer's name: "<<endl;
   cin>>name3;
   for(int j=0;j<=i;j++)
   {
    if(strcmp(customer[j]->get_name(),name3)==0)
    {
     cout<<name3<<"The housing information is as follows::\n";
     cout<<'\t'<<"Room number is: "<<customer[j]->get_room_number()<<endl;
     cout<<"\t"<<"Prepaid room rate is: "<<customer[j]->get_prepaid()<<endl;
    }
   }
  }
  if(inquire_choice=='2')
  {
   char id3[10];
   cout<<"Please enter the ID number of the customer.: "<<endl;
   cin>>id3;
   for(int j=0;j<=i;j++)
   {
    if(strcmp(customer[j]->get_ID(),id3)==0)
    {
     cout<<customer[j]->get_name()<<"The housing information is as follows::\n";
     cout<<'\t'<<"Room number is: "<<customer[j]->get_room_number()<<endl;
     cout<<"\t"<<"Prepaid room rate is: "<<customer[j]->get_prepaid()<<endl;
    }
   }
  }
 }
}

4, System source code

#include<iostream.h> 
#include<string.h>
//***********************************************************************************
void initial_room();	//Initialize 80 room information
void welcome();			//Verify that the user logs in and displays the welcome message successfully
void enter();
void book_room();
void check_in();
void check_out();
void inquire();
int i=0;
//***********************************************************************************
struct Room  
{
 int number;
 int dank;
 int price;
 int state; 
};

class Customer  
{
public:
 Customer();
 
 void set_name(char *n){strcpy(name,n);}
 void set_ID(char *p){strcpy(ID,p);}
 void set_room_number(int n){room_number=n;}
 void set_day(int d){day=d;}
 void set_prepaid(int p){prepaid=p;}
 char *get_name(){return name;}
 char *get_ID(){return ID;}
 int  get_room_number(){return room_number;}
 int  get_day(){return day;}
 int  get_prepaid(){return prepaid;} 
 
 virtual ~Customer();
private: 
 char name[10],ID[19]; 
 int  room_number;
 int  prepaid;
 int  change;
 int  day;
};
Customer::Customer()
{
 cout<<"Please enter the customer's name\n";
 cin>>name;
 cout<<"Please enter your customer ID card number.\n"; 
 cin>>ID; 
 prepaid=change=day=0;
}
Customer::~Customer()
{
 cout<<"The customer checked out successfully!"<<endl;
}
//***********************************************************************************
Room room[80];
Customer *customer[80];

void main()			//The program entry starts from here
{
 char choice='1';
 initial_room();	//Initialize the information of 80 rooms in four levels
 welcome();			//Verify that the user logs in and displays the welcome message successfully
 
 while(choice=='1')
 {
  enter();   //Perform different functions according to the user's choice
  cout<<endl;
  cout<<"To continue using the system, press\"1\",To exit, press\"2\"!  ";
  cin>>choice;
  cout<<endl;
 }
}
//System login interface***********************************************************************
void welcome()		//Verify that the user logs in and displays the welcome message successfully
{
 char name[4],code[7];
 cout<<"Please enter your user name and password(Separated by spaces):\n"; 
 cin>>name>>code;
 while((strcmp(name,"123")!=0)||(strcmp(code,"123")!=0))
 {
  cout<<"Incorrect user name or password,Please re-enter!\n";
  cin>>name>>code;
 }
 cout<<endl;
 cout<<endl;
 cout<<"                      ▲***************************▲\n"; 
 cout<<"                      △ Welcome to the hotel room management system!△\n"; 
 cout<<"                      ▲***************************▲\n"; 
 cout<<endl;
}
//System entrance***************************************************************************
void enter()
{
 int kind_of_service;
 cout<<"Please select service category:Reservation, check-in, check-out or inquiry? \n"; 
 cout<<" 1->Reservation 2->Check in 3->Check out 4->query:  ";
 cin>>kind_of_service; 
 if((kind_of_service>4) || (kind_of_service<1)) 
 {
  cout<<"Your input is incorrect. Please try again!\n"; 
  cin>>kind_of_service;
 } 
 else 
  switch(kind_of_service) 
 {
case 1: book_room();
 break;
case 2: check_in();
 break;
case 3: check_out();
 break;
case 4: inquire();
 break;
 } 
}


//Booking realization***************************************************************************
void book_room()
{
 customer[i]=new Customer;
 int room_standard,day;
 cout<<"Please select the standard of reservation:\n"; 
 cout<<"1.Single room/150 yuan per day\n2.Double room/200 yuan per day\n3.standard room/300 yuan per day\n4.presidential suite/600 yuan per day\n"; 
 cin>>room_standard; 
 cout<<"Please enter the scheduled days\n"; 
 cin>>day; 
 customer[i]->set_day(day);
 switch(room_standard) 
 { 
  int n;
 case 1:
  cout<<"The total cost of housing is: "<<day*150<<"element\n";		//Calculate housing costs
  for(n=0;n<20;n++)									//Find a free room from the first level of rooms
  {
   if(room[n].state==0)								//state=0 means the house is not booked
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break; 
 case 2:
  cout<<"The total cost of housing is: "<<day*200<<" element\n"; 
  for(n=20;n<40;n++)
  {
   if(room[n].state==0)
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break; 
 case 3:
  cout<<"The total cost of housing is: "<<day*300<<" element\n"; 
  for(n=40;n<60;n++)
  {
   if(room[n].state==0)
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break; 
 case 4:
  cout<<"The total cost of housing is: "<<day*600<<"element\n"; 
  for(n=60;n<80;n++)
  {
   if(room[n].state==0)
   {
    cout<<"Reservation successful★Room number is: "<<room[n].number<<endl;
                room[n].state=1;
    customer[i]->set_room_number(room[n].number);
    break;
   }
  }
  break;   
 }  
 i++;  //The number of customers in the house plus 1
}
//Check in***************************************************************************
void check_in()
{
    char name1[10],id1[19];
 int ding_or_no,prepaid;
 cout<<"Is it time for the customer to make a reservation? (1->Ordered 2->No order) ";
 cin>>ding_or_no;
 if(ding_or_no==1)
 {
  cout<<"Please enter the customer's name:"<<endl;
  cin>>name1;
  cout<<"Please enter the ID number of the customer.:"<<endl;
  cin>>id1;
  for(int j=0;j<=i;j++)
  {
   if((strcmp(customer[j]->get_name(),name1)==0)&&(strcmp(customer[j]->get_ID(),id1)==0))  //Find the reservation information of the customer
   {
    int num=customer[j]->get_room_number();  //Get the room number of the reservation
    cout<<"customer"<<name1<<"Stay in our hotel today! Room number is: "<<num<<endl;
    switch(num/100)
    {
    case 6:
     prepaid=customer[j]->get_day()*150;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl; //Start charging
     room[num%100-1].state=2;                  //Change room status to check-in status
     break;
    case 7:
     prepaid=customer[j]->get_day()*200;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl;
     room[19+num%100].state=2;
     break;
    case 8:
     prepaid=customer[j]->get_day()*300;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl;
     room[39+num%100].state=2;
     break;
    case 9:
     prepaid=customer[j]->get_day()*600;
     customer[j]->set_prepaid(prepaid);
     cout<<"Please charge for the room "<<prepaid<<"Yuan integer!"<<endl;
     room[59+num%100].state=2;
     break;
     
    }
    break;
   } 
  }
  
  
 } 
 else
 {
  customer[i]=new Customer;
  int room_standard,day;
  cout<<"Please select the standard of reservation:\n"; 
  cout<<"1.Single room/150 yuan per day\n2.Double room/200 yuan per day\n3.standard room/300 yuan per day\n4.presidential suite/600 yuan per day\n"; 
  cin>>room_standard; 
  cout<<"Please enter the number of days of stay\n"; 
  cin>>day; 
  customer[i]->set_day(day);
  switch(room_standard) 
  { 
   int n;
  case 1:
   prepaid=day*150;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=0;n<20;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break; 
  case 2:
   prepaid=day*200;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=20;n<40;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break; 
  case 3:
   prepaid=day*300;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=40;n<60;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break; 
  case 4:
   prepaid=day*600;
   customer[i]->set_prepaid(prepaid);
   cout<<"Please charge for the room "<<prepaid<<"Yuan integer!\n"; 
   for(n=60;n<80;n++)
   {
    if(room[n].state==0)
    {
     cout<<"Check in room number is: "<<room[n].number<<endl;
     room[n].state=2;
     customer[i]->set_room_number(room[n].number);
     break;
    }
   }
   break;   
  }  
  i++;
 }
}
//Check out settlement***************************************************************************
void check_out()
{
 char name2[10],id2[19];
 int standard,j,room_number,day1,day2,day;
 cout<<"Please enter the name and ID number of the customer to check out.:\n";
 cin>>name2>>id2; 
 cout<<"Please enter the actual number of days the customer lives:\n"; 
 cin>>day2; 
 for(j=0;j<i;j++)
 {
  if((strcmp(customer[j]->get_name(),name2)==0)&&(strcmp(customer[j]->get_ID(),id2)==0))
  {
   room_number=customer[j]->get_room_number();
   standard=room_number/100; 
   day1=customer[j]->get_day();
   day=day1-day2;
   switch(standard) 
   {
   case 6: 
    cout<<"What's the customer's room number"<<room_number<<" :Single room,150 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*150<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*150<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*150<<" Yuan integer!\n";
    break; 
   case 7:
    cout<<"What's the customer's room number"<<room_number<<" :Single room,200 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*200<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*200<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*200<<" Yuan integer!\n";
    break; 
   case 8:
    cout<<"What's the customer's room number"<<room_number<<" :Single room,300 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*300<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*300<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*300<<" Yuan integer!\n";
    break; 
   case 9:
    cout<<"What's the customer's room number"<<room_number<<" :Single room,600 yuan per day\n";
    cout<<"The customer prepaid the room rate "<<customer[j]->get_prepaid()<<"element, Actual consumption "<<day2*600<<"Yuan integer!\n";
    cout<<endl;
    if(day>0)
     cout<<"Please return it to the customer "<<day*600<<" Yuan integer!\n"; 
    if(day<0)
     cout<<"Please make up for the customer's housing fee "<<-day*600<<" Yuan integer!\n";
    break; 
   }
   cout<<endl;
   cout<<"Check out accounting is clear,Press 1: ";
   char account;
   cin>>account;
   if(account=='1')
   {
    for(int k=0;k<80;k++)
    {
     if(room[k].number==customer[j]->get_room_number()) 
      room[k].state=0;
    }
    i--;
    for(;j<i;j++)
    {
     customer[j]=customer[j+1];
    }
    delete customer[i];
   }
  }
 } 
}
//Information query***************************************************************************
void inquire()
{
 char inquire_choice;
 cout<<"For room information query, press 1, For customer information query, press 2: "<<endl;
 cin>>inquire_choice;
    if(inquire_choice=='1')
 {
  int j,k=0;
  cout<<endl;
  cout<<"The following rooms have not been reserved or checked in:"<<endl;
  for(j=0;j<80;j++)
  {
   if(room[j].state==0)
   {
    if(k%10==0) cout<<endl;
    cout<<room[j].number<<'\t';
    k++;
   }
  }
  cout<<endl;
  cout<<endl;
  k=0;
  cout<<"The following rooms are reserved:"<<endl;
  for(j=0;j<80;j++)
  {
   if(room[j].state==1)
   {
    if(k%10==0) cout<<endl;
    cout<<room[j].number<<'\t';
    k++;
   }
  }
  k=0;
  cout<<endl;
  cout<<endl;
  cout<<"The following rooms are occupied:"<<endl;
  for(j=0;j<80;j++)
  {
   if(room[j].state==2)
   {
    if(k%10==0) cout<<endl;
    cout<<room[j].number<<'\t';
    k++;
   }
  }
  cout<<endl;
  cout<<endl;
 }
 else if(inquire_choice=='2')
 {
  cout<<"To query by name, press 1, For inquiry by ID card, please press 2: "<<endl;
  char inquire_choice;
  cin>>inquire_choice;
  if(inquire_choice=='1')
  {
   char name3[10];
   cout<<"Please enter the customer's name: "<<endl;
   cin>>name3;
   for(int j=0;j<=i;j++)
   {
    if(strcmp(customer[j]->get_name(),name3)==0)
    {
     cout<<name3<<"The housing information is as follows::\n";
     cout<<'\t'<<"Room number is: "<<customer[j]->get_room_number()<<endl;
     cout<<"\t"<<"Prepaid room rate is: "<<customer[j]->get_prepaid()<<endl;
    }
   }
  }
  if(inquire_choice=='2')
  {
   char id3[10];
   cout<<"Please enter the ID number of the customer.: "<<endl;
   cin>>id3;
   for(int j=0;j<=i;j++)
   {
    if(strcmp(customer[j]->get_ID(),id3)==0)
    {
     cout<<customer[j]->get_name()<<"The housing information is as follows::\n";
     cout<<'\t'<<"Room number is: "<<customer[j]->get_room_number()<<endl;
     cout<<"\t"<<"Prepaid room rate is: "<<customer[j]->get_prepaid()<<endl;
    }
   }
  }
 }
}
//Room information initialization*********************************************************************
void initial_room()  //Initialize 80 rooms in 4 levels
{
 int j,k=601;
 for(j=0;j<20;j++)
 {
  room[j].number=k++;
  room[j].dank=1;
  room[j].price=150;
  room[j].state=0;
 }
 k=701;
 for(j=20;j<40;j++)
 {
  room[j].number=k++;
  room[j].dank=2;
  room[j].price=200;
  room[j].state=0;
 }
 k=801;
 for(j=40;j<60;j++)
 {
  room[j].number=k++;
  room[j].dank=3;
  room[j].price=300;
  room[j].state=0;
 }
 k=901;
 for(j=60;j<80;j++)
 {
  room[j].number=k++;
  room[j].dank=4;
  room[j].price=600;
  room[j].state=0;
 }
}

5, Screenshot of operation results

1. System login interface

2. Reservation function

3. Check in function

4. Check out function

5. Query function

6, Attachment / download address

be careful:  

The download address of "25 +" C + + & & C language final course design (super detailed) is attached below. The introduction of each system introduces the implementation function of the system in detail. You can find what you need according to the function. I will release it one by one in the next period of time. If you are in urgent need, please leave a message in the comment area. I will refer to it and publish the needed articles at the first time!!!

Download address of the system

C/C + + Course Design - course design hotel room management system (source code + course design report + detailed notes). zip-C/C + + Document Resources CSDN Library

C & C + + final course design

C & C + + - file grade (source code) - C/C + + Document Resources - CSDN Library

c& c + + Course Design -- library management system.zip_ Library management system c + + add and delete - C/C + + Document Resources - CSDN Library

C & C + + Course Design - student achievement management system. zip-C/C + + Document Resources CSDN Library

C/C + + Course Design - employee workload statistics system (source code and notes). zip-C/C + + Document Resources CSDN Library

C & C + + Course Design - class student file management system source code (source code + comments). zip-C/C + + Document Resources CSDN Library

C & C + + final course design - KTV song management system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C& C + + final course design - product information management system (source code + detailed notes) - C/C + + Document Resources - CSDN Library

 C & C + + final course design - personal revenue and expenditure management system (source code + detailed comments) - C/C + + Document Resources - CSDN Library

 C & C + + final course design - employee resource management system (source code + detailed comments) - C/C + + Document Resources - CSDN Library

C & C + + final course design - personal revenue and expenditure management system (II) (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language final course design:

C language curriculum design - faculty salary management system (source code + curriculum design + detailed notes). zip-C/C + + Document Resources CSDN Library

C language curriculum design - score management system source program. zip-C/C + + Document Resources - CSDN Library

C language course design - supermarket management system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language course design - train ticket booking management system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language course design - commodity sales system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language course design - address book management system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language curriculum design - library management system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language curriculum design - book borrowing system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language curriculum design - perpetual calendar system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language course design - text editor system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language curriculum design - student achievement management system. zip-C/C + + Document Resources - CSDN Library

 C language curriculum design - student achievement management system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language curriculum design - student information system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

C language curriculum design - drawing board system (source code + detailed notes). zip-C/C + + Document Resources CSDN Library

 -   Copyright notice: unless otherwise stated, the copyright of all articles on this blog belongs to the author. Reprint please indicate the source!

Posted by leeperryar on Wed, 06 Oct 2021 19:15:07 -0700