2022年C++版酒店管理程序代码教学教材 .pdf





《2022年C++版酒店管理程序代码教学教材 .pdf》由会员分享,可在线阅读,更多相关《2022年C++版酒店管理程序代码教学教材 .pdf(19页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、C+版 酒 店 管 理 程 序代 码名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 19 页 - - - - - - - - - 程序代码N:最终改进版代码(利用结构体储存多种类型的数据)好处:比数组能储存更多类型的数据!#include #include #include / 常用函数库using namespace std; /*在 c+中 struct 和类的区别在于struct 不能有方法,所有成员是public 的*/ struct Room int Numbe
2、r; int Price; int State; int days; string Name; string Phone; string ID; ;/room; 可以在声明 struct 的时候声明一个 struct 实例Room room80; class BookRoom /定义预定房间类 private: string cName; / 顾客姓名int stayTime; / 预定天数int roomType; / 房间类型( 1.标准单人间 2.大床房 3.标准双人间 4. 套房)string phoneNum; / 预留手机号名师资料总结 - - -精品资料欢迎下载 - - - -
3、- - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 19 页 - - - - - - - - - public: void setData() string name; int time; int type; string num; cout 您好,请输入您的姓名:name; cName=name; cout 预定天数为: time; stayTime=time; cout 想要预定的房间类型: 1.标准单人间 100/天 2.大床房 200/天 3.标准双人间 300/天 4.套房 400/天type; roomType=type
4、; cout 预留手机号: num; phoneNum=num; ; void Book() cout 正在预定 .roomType) case 1:for(int i=0;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; roomi.Price*=this-stayTime; cout 预定成功!房间号:roomi.Numberendlendl; roomi.State=1;break; / 已被预订 else coutroomi.Number号房间已有人 endl;break; 名师资料总结 - - -精品资料欢迎下载
5、 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 19 页 - - - - - - - - - case 2:for(int i=20;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; roomi.Price*=this-stayTime; cout 预定成功!房间号:roomi.Numberendlendl; roomi.State=1; break; else coutroomi.Number号房间已有人 endl; break; cas
6、e 3:for(int i=40;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; roomi.Price*=this-stayTime; cout 预定成功!房间号:roomi.Numberendlendl; roomi.State=1; break; else coutroomi.Number号房间已有人 endl;break; case 4:for(int i=60;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; roomi.Price*=th
7、is-stayTime; cout 预定成功!房间号:roomi.Numberendlendl; roomi.State=1; break; else coutroomi.Number号房间已有人endl; break; default:cout 您输入的房间类型有误! endl; ; ; class CheckIn /定义办理入住类 private: string cName; string cSex; string idNum; / 身份证号int check_inDate; / 入住日期 int stayTime; int roomType; string phoneNum; publi
8、c: void unbooked() string name; string sex; string idnum; int date; int time; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 19 页 - - - - - - - - - int type; string num; cout 客户姓名: name; cName=name; cout 客户性别: sex; cSex=sex; cout 客户身份证号: idnum; idNum=idnum; cou
9、t 入住日期: date; check_inDate=date; cout 占用天数: time;stayTime=time; cout 房间类型: 1.标准单人间 100/天 2.大床房 200/天 3.标准双人间 300/天 4.套房 400/天type;roomType=type; cout 客户手机号: num; phoneNum=num; switch(this-roomType) case 1:for(int i=0;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; roomi.Price*=this-stay
10、Time; roomi.ID=this-idNum; cout 入住成功!房间号:roomi.Numberendlendl; cout 请支付 200元押金 endlendl; roomi.State=1; break; else cout抱歉,该房间类型没有了 endl; break; case 2:for(int i=20;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - -
11、- - 第 6 页,共 19 页 - - - - - - - - - roomi.Price*=this-stayTime; roomi.ID=this-idNum; cout 入住成功!房间号:roomi.Numberendlendl; cout 请支付 400元押金 endlendl; roomi.State=1; break; else cout抱歉,该房间类型没有了 endl; break; case 3:for(int i=40;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; roomi.Price*=this
12、-stayTime; roomi.ID=this-idNum; cout 入住成功!房间号:roomi.Numberendlendl; cout 请支付 600元押金 endlendl; roomi.State=1; break; else cout抱歉,该房间类型没有了 endl; break; case 4:for(int i=60;istayTime; roomi.Name=this-cName; roomi.Phone=this-phoneNum; roomi.Price*=this-stayTime; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - -
13、- - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 19 页 - - - - - - - - - roomi.ID=this-idNum; cout 入住成功!房间号:roomi.Numberendlendl; cout 请支付 800元押金 endlendl; roomi.State=1; break; else cout抱歉,该房间类型没有了 endl; break; default:cout 您输入的房间类型有误! endl; void booked() string compareItem; string id_num; cout 请输入您的姓名或
14、者手机号:compareItem; for(int i=0;i80;i+) if(roomi.Name=compareItem|roomi.Phone=compareItem) cout 验证成功!请支付:(roomi.Price*2)元押金 endl; cout 请登记客户的身份证号:id_num;idNum=id_num;roomi.ID=idNum; cout 房间号为: roomi.Numberendl欢迎入住! endlendl; break; ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - -
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年C+版酒店管理程序代码教学教材 2022 C+ 酒店 管理 程序代码 教学 教材

限制150内