欢迎来到天天文库
浏览记录
ID:48515099
大小:26.67 KB
页数:18页
时间:2020-02-06
《C++版酒店管理程序代码.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、......程序代码N:最终改进版代码(利用结构体储存多种类型的数据)好处:比数组能储存更多类型的数据!#include#include#include//常用函数库usingnamespacestd;/*在c++中struct和类的区别在于struct不能有方法,所有成员是public的*/structRoom{intNumber;intPrice;intState;intdays;stringName;stringPhone;stringID;};//
2、room;可以在声明struct的时候声明一个struct实例Roomroom[80];classBookRoom//定义预定房间类{private:stringcName;//顾客姓名intstayTime;//预定天数introomType;//房间类型(1.标准单人间2.大床房3.标准双人间4.套房)stringphoneNum;//预留手机号.专业专注.......public:voidsetData(){stringname;inttime;inttype;stringnum;cout<<"您好,请
3、输入您的姓名:"<>name;cName=name;cout<<"预定天数为:"<>time;stayTime=time;cout<<"想要预定的房间类型:1.标准单人间100/天2.大床房200/天3.标准双人间300/天4.套房400/天"<>type;roomType=type;cout<<"预留手机号:"<>num;phoneNum=num;};voidBook(){cout<<"正在预定..."<4、(this->roomType){case1:for(inti=0;i<20;i++){if(room[i].State==0)//房间无人占用且无人预定{room[i].days=this->stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<5、;//已被预订}elsecout<stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<6、umber<stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"7、预定成功!房间号:"<stayTime;.专业专注.......room[i].Name=this->cName;room[i].Phone=this->phoneNum;room8、[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<
4、(this->roomType){case1:for(inti=0;i<20;i++){if(room[i].State==0)//房间无人占用且无人预定{room[i].days=this->stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<5、;//已被预订}elsecout<stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<6、umber<stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"7、预定成功!房间号:"<stayTime;.专业专注.......room[i].Name=this->cName;room[i].Phone=this->phoneNum;room8、[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<
5、;//已被预订}elsecout<stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<6、umber<stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"7、预定成功!房间号:"<stayTime;.专业专注.......room[i].Name=this->cName;room[i].Phone=this->phoneNum;room8、[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<
6、umber<stayTime;room[i].Name=this->cName;room[i].Phone=this->phoneNum;room[i].Price*=this->stayTime;cout<<"
7、预定成功!房间号:"<stayTime;.专业专注.......room[i].Name=this->cName;room[i].Phone=this->phoneNum;room
8、[i].Price*=this->stayTime;cout<<"预定成功!房间号:"<
此文档下载收益归作者所有