This project is a simple Hotel Management System written in C++. It includes functionalities such as booking rooms, checking in, checking out, and inquiring room status.
- Room Booking: Allows customers to book rooms based on room standards.
- Check-In: Handles customer check-in, either with a prior booking or without.
- Check-Out: Manages customer check-out, including billing based on actual stay duration.
- Inquiry: Provides information on room status (available, booked, occupied) and customer details.
- Initialize Rooms: The
initial_room()
function initializes the details of 80 rooms, categorized into four standards. - Welcome Screen: The
welcome()
function prompts for user login. The correct username and password are "000" and "666666" respectively.
- Book Room: The
book_room()
function allows customers to book rooms by selecting the room standard and number of days. - Check In: The
check_in()
function handles customer check-in, charging based on the selected room standard and number of days. - Check Out: The
check_out()
function manages customer check-out, adjusting the bill based on actual stay duration. - Inquiry: The
inquire()
function provides room status information and customer details.
- Start the program.
- Login with the correct username and password.
- Select the desired service from booking, check-in, check-out, or inquiry.
- Follow the prompts to complete the selected service.
- To continue using the system, press "1". To exit, press "2".
- Customer: Manages customer information including name, ID, room number, days of stay, and prepaid amount.
- initial_room(): Initializes room information.
- welcome(): Handles user login.
- enter(): Directs to the appropriate service based on user input.
- book_room(): Books a room for a customer.
- check_in(): Manages customer check-in process.
- check_out(): Manages customer check-out process.
- inquire(): Provides room and customer information based on the query.
#include <iostream>
#include <cstring>
using namespace std;
// Function declarations
void initial_room();
void welcome();
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(const char* n) { strcpy_s(name, n); }
void set_ID(const char* p) { strcpy_s(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; }
const char* get_name() { return name; }
const 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;
};
// Function definitions
// ...
int main() {
char choice = '1';
initial_room();
welcome();
while (choice == '1') {
enter();
cout << endl;
cout << "继续使用本系统请按\"1\", 退出请按\"2\"! ";
cin >> choice;
cout << endl;
}
return 0;
}
// Implementations of functions
// ...