1、程序代码与说明#ifndef CLIENT#define CLIENT#includeFoodManager.h#includeusing namespace std;class Clientprivate: int number; /客户编号 int type; /客户的类型,1暗示就餐,2暗示外卖 double fee; /客户账单用度 char *name; /客户名称 char *phone; /客户手机号码public: Client() /机关函数 char * getName(); /前往客户姓名 int num100; /numi存储食物数量,i暗示食物编号 FoodManag
2、er client_fm; /办理客户所点的食物 Client(char *n,char *p);/机关函数 int getNumber(); /前往客户编号 void setNumber(int n); /设置客户编号 int getType(); /前往客户类型 void setType(int n); /设置客户类型 void addFee(double x); /添加用度 double getFee(); /前往用度 void showClientMessage();/展示客户信息 void changNum(); /修改客户所点的食物的数量 void deleFood(); /删除客
3、户所选择的食物;#endifClient.hiomanipClient:Client(char *s,char *p) name = s; phone = p; fee = 0; for(int i = 0 ; i 100 ; i+) numi = 0 ; cout客户注册成功endl;int Client:getNumber() return number;void Client:setNumber(int n) number = n;getType() return type;setType(int n) type = n;addFee(double x) fee += x;double
4、Client:getFee() return fee;showClientMessage() char * ss; if(type = 1)ss = 就餐; else if(type = 2)ss = 外卖姓名: namettss手机号码:phone订单总价:fee订单详情:setw(10)setiosflags(ios:left)食物序列菜名t数量t价格 client_fm.getTotal() ; i +) i+1client_fm.foodi.getName()tnuminumi*client_fm.foodi.getPrice()n;您选择了食物:client_fm.getNameBy
5、List(n-1)请输入数量:numss; fee += (numss - numn-1 )*client_fm.getPriceByName(client_fm.getNameByList(n-1); numn-1=numss;deleFood() fee -= (numn-1 )*client_fm.getPriceByName(client_fm.getNameByList(n-1); for(int i = n-1 ; client_fm.foodi=client_fm.foodi+1; numi=numi+1; client_fm.setTotal(client_fm.getTota
6、l()-1);#ifndef CLIENTMANAGER#define CLIENTMANAGER#define MAX_CLIENT_NUM 60 /最大客户数量class ClientManager ClientManager(); /机关函数 int clientNum ; /记录客户数量 Client clientMAX_CLIENT_NUM; /记录存储客户 void addClient(Client c); /添加新客户 int getClientNum(); /前往客户数量 void showQuery(char * s); /查询客户 void showAll(); /显示所有
7、客户ClientManager.hClientManager:ClientManager() clientNum = 0;void ClientManager:addClient(Client c) clientclientNum+ = c;int ClientManager:getClientNum() return clientNum;showQuery(char * s) int count = 0; int th;- for(int i = 0; clientNum ; if(clienti.getType()=1)第+count单:clienti.getName()t总价是:clie
8、nti.getFee()元t就餐endl if(strcmp(clienti.getName(),s)=0)th =count; if(clienti.getType()=2)t外卖您当前排在第th单showAll() i + )订单号: clienti.showClientMessage();#ifndef FOOD#define FOODclass Food private: /食物名称 double price; /食物价格 public: Food(); Food(char *s,double p); void setName(char *s); /更改食物名称 char* getNa
9、me(); /前往食物名称 double getPrice(); /前往食物价格 void setPrice(double p); /设置食物价格 void showMessage(); /显示食物的名称和价格Food.hFood:Food(char *s,double p) price = p;void Food:setName(char *s)setPrice(double p)showMessage()pricedouble Food:getPrice() return price;char* Food:#ifndef FOODMANAGER#define FOODMANAGER#def
10、ine MAX_FOOD_NUM 99 /最多容纳的食物种类数class FoodManager int total ; /食物种类数 FoodManager(); int getTotal() ; /前往食物种类数 Food foodMAX_FOOD_NUM; /记录食物 void addFood(Food f); /添加食物 void addFood(char *s,double p); void deleteFood(); /删除食物 void changePrice(); /修改食物价格 void showFood(); /显示食物信息 char * getNameByList(int
11、 list); /通过食物编号前往食物名称 double getPriceByName(char *s); /通过食物名称前往食物价格 int getListByName(char *s); /通过食物名称前往食物编号 void setTotal(int x); /修改食物种类数FoodManager:FoodManager() total = 0;void FoodManager:addFood(Food f) foodtotal+=f;成功添加了食物,当前共有totalshowFood()食物中共有种食物编号 名称tt单价 total ;ifoodi.getName()foodi.getP
12、rice()code; s = foodcode.getName();s请输入价格:p; if(strcmp(foodi.getName(),s)=0) foodi.setPrice(p);修改成功 return;没有这种食物,修改失败deleteFood()请输入菜名:s;成功删除 total -; for(int t = i; t t +) foodt=foodt+1;没有这种食物addFood(char *s , double p) foodtotal+=Food(s,p);double FoodManager:getPriceByName(char *s) return foodi.g
13、etPrice(); return false;int FoodManager:getListByName(char *s) return i;getTotal() return total;char * FoodManager:getNameByList(int list) return foodlist.getName();setTotal(int x) total = x;#ifndef FEEMANAGER#define FEEMANAGERclass FeeManager double jiuCanFee; /就餐总收入 double waiMaiFee; /外卖总收入 FeeMan
14、ager(); double getWaiMaiFee(); /前往外卖总收入 double getJiuCanFee(); /前往就餐总收入 void addWaiMaiFee(double x); /增加外卖总收入 void addJiuCanFee(double x); /添加就餐总收入FeeManager.hFeeManager:FeeManager() jiuCanFee = 0; waiMaiFee = 0;double FeeManager:getWaiMaiFee() return waiMaiFee;getJiuCanFee() return jiuCanFee;void F
15、eeManager:addWaiMaiFee(double x) waiMaiFee += x;addJiuCanFee(double x) jiuCanFee += x;#ifndef MENUVIEW#define MENUVIEWclass MenuView char whiteSmile; /白色笑脸 char blackSmile; /黑色笑脸 char heart; /心形图形 MenuView(); void showJiuCan(); /显示就餐用户点菜界面 void showWaiMai(); /显示外卖用户点菜界面 int showMain(); /显示用户选择就餐还是外卖
16、界面 int showViewChoice(); /显示进入本系统的功效选择界面 int showRegister(); /显示客户注册界面 int showClientChoice(); /显示客户点餐界面 int showQuery(); /显示查询客户订单界面 int showMend(); /显示修改食物界面 int showMenuChoice(); /显示选择菜单界面 int showMendDingDan(); /显示客户修改订单界面MenuView.hMenuView:MenuView() whiteSmile = 1; blackSmile = 2; heart = 3;int MenuView:showMain() for(int i = 1 ;= 80 ; i+ )coutheart; for(int i = 1;=80;i+)if(i=1|i=80)coutelse cout hearttttt欢迎惠临本餐厅 for(int j=1;j=33;j+)coutcout /输出餐厅的外形t我是办事员小坠whiteSmile,竭诚为您办事哦blackSmile for(int k=1;k=10;k+)cout= 20 ;请选择您需要的办事= 60 ;1:for(int i = 1 ;= 52 ; i + )cout
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1