数据结构美团餐馆预订管理信息系统c++
时间: 2024-01-01 13:05:23 浏览: 150
根据提供的引用内容,我们可以了解到美团外卖管理信息系统方案和开发一个小型餐馆管理系统。下面是一个简单的美团餐馆预订管理信息系统的C++数据结构设计:
```c++
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// 定义包间类型
enum RoomType {
SMALL = 8,
MEDIUM = 12,
LARGE = 14
};
// 定义包间状态
enum RoomStatus {
FREE,
RESERVED,
DINING
};
// 定义订餐信息结构体
struct Reservation {
int roomNumber; // 包间编号
RoomType roomType; // 包间类型
RoomStatus roomStatus; // 包间状态
string customerName; // 订餐人姓名
string contact; // 联系方式
int numberOfPeople; // 用餐人数
string diningTime; // 用餐时间
};
// 定义餐馆管理系统类
class Restaurant {
private:
vector<Reservation> reservations; // 存储所有订餐信息的向量
public:
// 添加订餐信息
void addReservation(int roomNumber, RoomType roomType, RoomStatus roomStatus, string customerName, string contact, int numberOfPeople, string diningTime) {
Reservation reservation = {roomNumber, roomType, roomStatus, customerName, contact, numberOfPeople, diningTime};
reservations.push_back(reservation);
}
// 根据包间编号查询订餐信息
Reservation findReservationByRoomNumber(int roomNumber) {
for (int i = 0; i < reservations.size(); i++) {
if (reservations[i].roomNumber == roomNumber) {
return reservations[i];
}
}
Reservation emptyReservation = {-1, SMALL, FREE, "", "", 0, ""};
return emptyReservation;
}
// 根据订餐人姓名查询订餐信息
vector<Reservation> findReservationsByCustomerName(string customerName) {
vector<Reservation> result;
for (int i = 0; i < reservations.size(); i++) {
if (reservations[i].customerName == customerName) {
result.push_back(reservations[i]);
}
}
return result;
}
// 根据用餐时间查询订餐信息
vector<Reservation> findReservationsByDiningTime(string diningTime) {
vector<Reservation> result;
for (int i = 0; i < reservations.size(); i++) {
if (reservations[i].diningTime == diningTime) {
result.push_back(reservations[i]);
}
}
return result;
}
};
int main() {
Restaurant restaurant;
restaurant.addReservation(101, SMALL, FREE, "张三", "13888888888", 6, "中午");
restaurant.addReservation(102, MEDIUM, RESERVED, "李四", "13999999999", 10, "晚上");
restaurant.addReservation(103, LARGE, DINING, "王五", "13666666666", 16, "中午");
Reservation reservation1 = restaurant.findReservationByRoomNumber(101);
cout << "Room Number: " << reservation1.roomNumber << endl;
cout << "Room Type: " << reservation1.roomType << endl;
cout << "Room Status: " << reservation1.roomStatus << endl;
cout << "Customer Name: " << reservation1.customerName << endl;
cout << "Contact: " << reservation1.contact << endl;
cout << "Number of People: " << reservation1.numberOfPeople << endl;
cout << "Dining Time: " << reservation1.diningTime << endl;
vector<Reservation> reservations = restaurant.findReservationsByCustomerName("李四");
for (int i = 0; i < reservations.size(); i++) {
cout << "Room Number: " << reservations[i].roomNumber << endl;
cout << "Room Type: " << reservations[i].roomType << endl;
cout << "Room Status: " << reservations[i].roomStatus << endl;
cout << "Customer Name: " << reservations[i].customerName << endl;
cout << "Contact: " << reservations[i].contact << endl;
cout << "Number of People: " << reservations[i].numberOfPeople << endl;
cout << "Dining Time: " << reservations[i].diningTime << endl;
}
vector<Reservation> reservations2 = restaurant.findReservationsByDiningTime("中午");
for (int i = 0; i < reservations2.size(); i++) {
cout << "Room Number: " << reservations2[i].roomNumber << endl;
cout << "Room Type: " << reservations2[i].roomType << endl;
cout << "Room Status: " << reservations2[i].roomStatus << endl;
cout << "Customer Name: " << reservations2[i].customerName << endl;
cout << "Contact: " << reservations2[i].contact << endl;
cout << "Number of People: " << reservations2[i].numberOfPeople << endl;
cout << "Dining Time: " << reservations2[i].diningTime << endl;
}
return 0;
}
```
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)