帮我找一份c++客房管理系统
时间: 2023-06-06 10:05:50 浏览: 96
好的,我可以帮您找到一些现成的 C 客房管理系统。您可以通过访问一些软件下载网站如CSDN、GitHub等找到适合您的C客房管理系统。如果您需要定制化的话,可以联系专业的软件开发公司,他们会根据您的具体需求开发出符合您要求的C客房管理系统。
相关问题
假设你是一个程序设计师,请用c++写一段宾馆客房管理系统的代码,要求包含以下功能:客房管理:包括客房信息维护、客房状态管理、客房预订、入住和退房管理等。 顾客管理:包括顾客信息维护、订单管理、结算管理等。 员工管理:包括员工信息维护、权限管理、工资管理等。
好的,以下是一份简单的宾馆客房管理系统的 C++ 代码,包含了客房、顾客和员工的基本信息和操作:
```c++
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// 客房类
class Room {
public:
Room(int id, string type, float price) {
this->id = id;
this->type = type;
this->price = price;
this->status = "available";
}
int getId() const {
return id;
}
string getType() const {
return type;
}
float getPrice() const {
return price;
}
string getStatus() const {
return status;
}
void setStatus(string status) {
this->status = status;
}
private:
int id; // 客房编号
string type; // 客房类型
float price; // 客房价格
string status; // 客房状态(available, booked, checked_in, checked_out)
};
// 顾客类
class Customer {
public:
Customer(int id, string name, string phone) {
this->id = id;
this->name = name;
this->phone = phone;
}
int getId() const {
return id;
}
string getName() const {
return name;
}
string getPhone() const {
return phone;
}
private:
int id; // 顾客编号
string name; // 顾客姓名
string phone; // 顾客电话
};
// 员工类
class Employee {
public:
Employee(int id, string name, string position, float salary) {
this->id = id;
this->name = name;
this->position = position;
this->salary = salary;
}
int getId() const {
return id;
}
string getName() const {
return name;
}
string getPosition() const {
return position;
}
float getSalary() const {
return salary;
}
private:
int id; // 员工编号
string name; // 员工姓名
string position; // 员工职位
float salary; // 员工工资
};
// 宾馆类
class Hotel {
public:
// 初始化宾馆
Hotel() {
// 添加客房
rooms.push_back(Room(101, "single", 500));
rooms.push_back(Room(102, "single", 500));
rooms.push_back(Room(201, "double", 800));
rooms.push_back(Room(202, "double", 800));
rooms.push_back(Room(301, "suite", 1200));
rooms.push_back(Room(302, "suite", 1200));
// 添加员工
employees.push_back(Employee(1, "Tom", "manager", 10000));
employees.push_back(Employee(2, "Jerry", "receptionist", 5000));
employees.push_back(Employee(3, "Kate", "cleaner", 3000));
}
// 客房管理
void roomManagement() {
int choice;
do {
cout << "1. 查询客房信息" << endl;
cout << "2. 预订客房" << endl;
cout << "3. 入住客房" << endl;
cout << "4. 退房结算" << endl;
cout << "0. 返回上级菜单" << endl;
cout << "请选择操作:";
cin >> choice;
switch (choice) {
case 1:
displayRooms();
break;
case 2:
bookRoom();
break;
case 3:
checkInRoom();
break;
case 4:
checkOutRoom();
break;
case 0:
break;
default:
cout << "无效的操作,请重新选择!" << endl;
break;
}
} while (choice != 0);
}
// 顾客管理
void customerManagement() {
int choice;
do {
cout << "1. 查询顾客信息" << endl;
cout << "2. 下订单" << endl;
cout << "3. 结算订单" << endl;
cout << "0. 返回上级菜单" << endl;
cout << "请选择操作:";
cin >> choice;
switch (choice) {
case 1:
displayCustomers();
break;
case 2:
placeOrder();
break;
case 3:
settleOrder();
break;
case 0:
break;
default:
cout << "无效的操作,请重新选择!" << endl;
break;
}
} while (choice != 0);
}
// 员工管理
void employeeManagement() {
int choice;
do {
cout << "1. 查询员工信息" << endl;
cout << "2. 设置员工权限" << endl;
cout << "3. 修改员工工资" << endl;
cout << "0. 返回上级菜单" << endl;
cout << "请选择操作:";
cin >> choice;
switch (choice) {
case 1:
displayEmployees();
break;
case 2:
setEmployeePermission();
break;
case 3:
modifyEmployeeSalary();
break;
case 0:
break;
default:
cout << "无效的操作,请重新选择!" << endl;
break;
}
} while (choice != 0);
}
private:
vector<Room> rooms; // 客房列表
vector<Customer> customers; // 顾客列表
vector<Employee> employees; // 员工列表
// 查询客房信息
void displayRooms() {
cout << "客房编号\t客房类型\t客房价格\t客房状态" << endl;
for (const auto& room : rooms) {
cout << room.getId() << "\t\t" << room.getType() << "\t\t" << room.getPrice() << "\t\t" << room.getStatus() << endl;
}
}
// 预订客房
void bookRoom() {
int room_id;
cout << "请输入要预订的客房编号:";
cin >> room_id;
for (auto& room : rooms) {
if (room.getId() == room_id) {
if (room.getStatus() == "available") {
room.setStatus("booked");
cout << "客房 " << room_id << " 预订成功!" << endl;
} else {
cout << "客房 " << room_id << " 不可预订!" << endl;
}
return;
}
}
cout << "客房 " << room_id << " 不存在!" << endl;
}
// 入住客房
void checkInRoom() {
int room_id;
cout << "请输入要入住的客房编号:";
cin >> room_id;
for (auto& room : rooms) {
if (room.getId() == room_id) {
if (room.getStatus() == "booked") {
room.setStatus("checked_in");
cout << "客房 " << room_id << " 入住成功!" << endl;
} else {
cout << "客房 " << room_id << " 不可入住!" << endl;
}
return;
}
}
cout << "客房 " << room_id << " 不存在!" << endl;
}
// 退房结算
void checkOutRoom() {
int room_id;
cout << "请输入要退房的客房编号:";
cin >> room_id;
for (auto& room : rooms) {
if (room.getId() == room_id) {
if (room.getStatus() == "checked_in") {
room.setStatus("checked_out");
cout << "客房 " << room_id << " 退房成功!" << endl;
cout << "应付金额为:" << room.getPrice() << endl;
} else {
cout << "客房 " << room_id << " 不可退房!" << endl;
}
return;
}
}
cout << "客房 " << room_id << " 不存在!" << endl;
}
// 查询顾客信息
void displayCustomers() {
cout << "顾客编号\t顾客姓名\t顾客电话" << endl;
for (const auto& customer : customers) {
cout << customer.getId() << "\t\t" << customer.getName() << "\t\t" << customer.getPhone() << endl;
}
}
// 下订单
void placeOrder() {
int customer_id, room_id;
cout << "请输入顾客编号:";
cin >> customer_id;
cout << "请输入要预订的客房编号:";
cin >> room_id;
for (const auto& room : rooms) {
if (room.getId() == room_id && room.getStatus() == "available") {
customers.push_back(Customer(customer_id, "", ""));
room.setStatus("booked");
cout << "订单成功,客房 " << room_id << " 已被预订!" << endl;
return;
}
}
cout << "客房 " << room_id << " 不可预订!" << endl;
}
// 结算订单
void settleOrder() {
int room_id;
cout << "请输入要结算的客房编号:";
cin >> room_id;
for (auto& room : rooms) {
if (room.getId() == room_id && room.getStatus() == "booked") {
room.setStatus("checked_out");
cout << "订单结算成功!" << endl;
return;
}
}
cout << "客房 " << room_id << " 不可结算!" << endl;
}
// 查询员工信息
void displayEmployees() {
cout << "员工编号\t员工姓名\t员工职位\t员工工资" << endl;
for (const auto& employee : employees) {
cout << employee.getId() << "\t\t" << employee.getName() << "\t\t" << employee.getPosition() << "\t\t" << employee.getSalary() << endl;
}
}
// 设置员工权限
void setEmployeePermission() {
int employee_id;
string permission;
cout << "请输入要设置权限的员工编号:";
cin >> employee_id;
cout << "请输入要设置的权限(例如:admin, receptionist, cleaner):";
cin >> permission;
for (auto& employee : employees) {
if (employee.getId() == employee_id) {
employee.setPosition(permission);
cout << "员工权限设置成功!" << endl;
return;
}
}
cout << "员工 " << employee_id << " 不存在!" << endl;
}
// 修改员工工资
void modifyEmployeeSalary() {
int employee_id;
float salary;
cout << "请输入要修改工资的员工编号:";
cin >> employee_id;
cout << "请输入员工新的工资:";
cin >> salary;
for (auto& employee : employees) {
if (employee.getId() == employee_id) {
employee.setSalary(salary);
cout << "员工工资修改成功!" << endl;
return;
}
}
cout << "员工 " << employee_id << " 不存在!" << endl;
}
};
int main() {
Hotel hotel;
int choice;
do {
cout << "1. 客房管理" << endl;
cout << "2. 顾客管理" << endl;
cout << "3. 员工管理" << endl;
cout << "0. 退出系统" << endl;
cout << "请选择操作:";
cin >> choice;
switch (choice) {
case 1:
hotel.roomManagement();
break;
case 2:
hotel.customerManagement();
break;
case 3:
hotel.employeeManagement();
break;
case 0:
break;
default:
cout << "无效的操作,请重新选择!" << endl;
break;
}
} while (choice != 0);
return 0;
}
```
这段代码包含了宾馆客房管理系统的基本功能,包括客房管理、顾客管理和员工管理等。在宾馆类中,我们定义了客房、顾客和员工的基本信息,以及对应的操作函数。在主函数中,我们可以通过选择不同的操作进入不同的管理菜单。
阅读全文