用C++编写餐饮商家信息管理代码,包括餐厅编号、餐厅名称、开业时间、包间种类(10人以下就餐、10-20人就餐、30人以上就餐)及包间数量、详细地址、交通情况、餐饮种类(湘菜、川菜、鲁菜、烧烤等)、营业时间、有无演艺表演、平均消费价位、餐厅法人、餐厅法人身份证号、备注
时间: 2023-09-17 12:13:01 浏览: 116
以下是一个简单的餐饮商家信息管理代码,使用C++语言编写:
```c++
#include <iostream>
#include <string>
using namespace std;
class Restaurant {
private:
int id;
string name;
string openTime;
int smallRoomNum;
int mediumRoomNum;
int largeRoomNum;
string address;
string transportation;
string cuisineType;
string businessHours;
bool hasPerformance;
double averagePrice;
string legalPerson;
string idCard;
string note;
public:
Restaurant(int id, string name, string openTime, int smallRoomNum, int mediumRoomNum, int largeRoomNum,
string address, string transportation, string cuisineType, string businessHours,
bool hasPerformance, double averagePrice, string legalPerson, string idCard, string note) {
this->id = id;
this->name = name;
this->openTime = openTime;
this->smallRoomNum = smallRoomNum;
this->mediumRoomNum = mediumRoomNum;
this->largeRoomNum = largeRoomNum;
this->address = address;
this->transportation = transportation;
this->cuisineType = cuisineType;
this->businessHours = businessHours;
this->hasPerformance = hasPerformance;
this->averagePrice = averagePrice;
this->legalPerson = legalPerson;
this->idCard = idCard;
this->note = note;
}
void displayInfo() {
cout << "餐厅编号:" << id << endl;
cout << "餐厅名称:" << name << endl;
cout << "开业时间:" << openTime << endl;
cout << "包间种类:" << endl;
cout << "10人以下就餐:" << smallRoomNum << " 个" << endl;
cout << "10-20人就餐:" << mediumRoomNum << " 个" << endl;
cout << "30人以上就餐:" << largeRoomNum << " 个" << endl;
cout << "详细地址:" << address << endl;
cout << "交通情况:" << transportation << endl;
cout << "餐饮种类:" << cuisineType << endl;
cout << "营业时间:" << businessHours << endl;
cout << "有无演艺表演:" << (hasPerformance ? "是" : "否") << endl;
cout << "平均消费价位:" << averagePrice << " 元/人" << endl;
cout << "餐厅法人:" << legalPerson << endl;
cout << "餐厅法人身份证号:" << idCard << endl;
cout << "备注:" << note << endl;
}
};
int main() {
Restaurant res(1, "XXX餐厅", "2021年5月1日", 3, 2, 1, "广州市天河区XXX路XXX号", "地铁2号线XXX站A出口", "湘菜、川菜、粤菜", "周一至周日 10:00-22:00",
true, 50.0, "张三", "440123********1234", "欢迎光临!");
res.displayInfo();
return 0;
}
```
该代码通过定义餐厅类Restaurant,包含了所需的所有属性,并提供了显示餐厅信息的函数displayInfo。在主函数中创建一个餐厅对象并调用displayInfo函数进行信息展示。可以根据需要扩展该类的功能实现更复杂的餐饮商家信息管理系统。