




免费预览已结束,剩余8页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
_#include #include #include#include#include/-结构定义-typedef struct CheckinInformationchar name10; /姓名int id; /证件号int roomType; /房型int countType; /计费方式CheckinInfo;typedef struct HotelRoomint roomType; /房型int roomNum; /房号int checked; /入住情况int price; /房价Room;typedef struct RoomOrderCheckinInfo *checkinInfo; /入住信息long date; /入住时间Room * room; /房间信息Order;typedef struct HotelInfomationint checkinAmount; /已入住房数int singleRemainAmount; /单人房剩余房数int doubleRemainAmount; /双人房剩余房数int bigRemainAmount; /大床房剩余房数HotelInfo;/-枚举类型-enum MainUI,HotelInfoUI,CheckinUI,CheckinResultUI,OrderUI,CheckOutUI,Exit;/GUIenum Single,Double,Big;/Room Typeenum Hour,Day;/countType/-全局变量-int GUI = MainUI;Order* orderList100;/订单数组Room* roomList100;/房间数组HotelInfo * hotelInfo = NULL;/酒店房间信息/-函数声明-void initiallizeRoomList();void insertToOrderList(Order * order);Room* getRoomByType(int roomType);Order* getOrderByRoomNum(int roomNum);void showMainUI();void showHotelInfoUI();void showCheckinUI();void showCheckinResultUI();void showOrderUI();void showCheckOutUI();/-Main函数-void main() /主函数/初始化酒店房间信息hotelInfo = (HotelInfo *)malloc(sizeof(HotelInfo); hotelInfo - singleRemainAmount = 20;hotelInfo - doubleRemainAmount=40;hotelInfo - bigRemainAmount=40;hotelInfo - checkinAmount=0;/初始化房间列表initiallizeRoomList();/界面显示while(GUI != Exit)switch(GUI)case MainUI:showMainUI();break;case HotelInfoUI:showHotelInfoUI();break;case CheckinUI:showCheckinUI();break;case CheckinResultUI:showCheckinResultUI();break;case OrderUI:showOrderUI();break;case CheckOutUI:showCheckOutUI();break;default: break;/-函数定义-void initiallizeRoomList()/房间数组初始化,初始化的结果是让roomList的数组有100个room指针,而且设置了相应的值int i;Room*newRoom=NULL;for(i=0;ichecked=0; roomListi-price=110; roomListi-roomNum=i+1; roomListi-roomType=Single;for(i=20;ichecked=0; roomListi-price=180; roomListi-roomNum=i+1; roomListi-roomType=Double;for(i=60;ichecked=0; roomListi-price=180; roomListi-roomNum=i+1; roomListi-roomType=Big;/通过所选择的房型获取空房间,获取房间后将房间信息改为已入住,并减少相应房型的剩余房间数Room* getRoomByType(int roomType)int i;switch(roomType)case Single:for(i=0;ichecked = 0)roomListi-checked=1;hotelInfo-singleRemainAmount - ;hotelInfo-checkinAmount+;return roomListi;break;case Double:for(i=20;ichecked = 0)roomListi-checked=1;hotelInfo-doubleRemainAmount - ;hotelInfo-checkinAmount+;return roomListi;break;case Big:for(i=60;ichecked = 0)roomListi-checked=1;hotelInfo-bigRemainAmount -;hotelInfo-checkinAmount+;return roomListi;break;/将订单放入订单列表void insertToOrderList(Order * order)int i;for( i = 0;i100;i+)if( orderListi =NULL )orderListi = order;break;/通过房号查询订单Order* getOrderByRoomNum(int roomNum)int i;for(i=0;iroom-roomNum = roomNum)return orderListi;void showMainUI()/显示主界面,并接受输入int chooseNum;system(cls);printf(nn=酒店房间登记与计费管理管理系统=tnnn);printf(*tttt1. 入住登记 tttt*n);printf(*tttt2. 查询入住情况 ttt*n);printf(*tttt3. 查询当前费用 ttt*n);printf(*tttt4. 结账退房 tttt*n);printf(*tttt5. 退出程序 tttt*nnn);printf(nn=酒店房间登记与计费管理管理系统=tnnn);printf(请输入相应编号进入菜单t);/接受输入scanf(%d,&chooseNum);switch(chooseNum)case 1:GUI = HotelInfoUI;break;case 2:GUI = HotelInfoUI;break;case 3:GUI = OrderUI;break;case 4:GUI = OrderUI;break;case 5: Sleep(3000);GUI = Exit;break;default:break;void showHotelInfoUI()int chooseNum;system(cls);printf(nn=酒店入住情况查询菜单=tnnnn);printf(*ttt入住房间数: %dtttt*n, hotelInfo-checkinAmount);printf(*ttt剩余房间数: t);printf(单人房:%dtt*n,hotelInfo-singleRemainAmount);printf(*ttttt双人房:%dtt*n,hotelInfo-doubleRemainAmount);printf(*ttttt大床房:%dtt*nn,hotelInfo-bigRemainAmount);printf(nn=酒店入住情况查询菜单=tnnn);printf(按 0 :返回 n);printf(按 1 : 登记入住n);scanf(%d,&chooseNum);switch(chooseNum)case 0:GUI = MainUI;break;case 1:GUI = CheckinUI;break;default:GUI = HotelInfoUI;break;void showCheckinUI()Order * newOrder;Room* newRoom = NULL;/填写一个新的入住信息CheckinInfo * newCheckinInfo = NULL;int roomTypeNum;int countTypeNum;time_t timep;system(cls);printf(nn=酒店入住登记菜单=tnnn);newCheckinInfo = ( CheckinInfo * )malloc(sizeof(CheckinInfo);printf(*tt请输入姓名:);scanf(%s, &(newCheckinInfo-name) );printf(*tt请输入证件号:);scanf(%d, &(newCheckinInfo-id) );printf(*tt请选择入住房型:n);printf(ttt1.单人房nttt2.双人房nttt3.大床房n);scanf(%d,&(roomTypeNum);switch(roomTypeNum) /通过输入的数字对应房型case 1:newCheckinInfo-roomType = Single;break;case 2:newCheckinInfo-roomType = Double;break;case 3:newCheckinInfo-roomType = Big;break;default:newCheckinInfo-roomType = Single;break;printf(*tt请选择计费方式:n);printf(ttt1.按小时计费; nttt2.按天数计费n); /通过输入的数字对应计费方式 scanf(%d,&countTypeNum);switch(countTypeNum)case 1:newCheckinInfo-countType = Hour;break;case 2:newCheckinInfo-countType = Day;break;printf(nn=酒店入住登记菜单=tnnn);/生成一个新的订单newOrder = ( Order* )malloc(sizeof(Order);newOrder - checkinInfo = newCheckinInfo;newOrder - date = time(0);switch(newCheckinInfo-roomType) /通过房型获取房间case Single:newRoom = getRoomByType(Single);break;case Double:newRoom=getRoomByType(Double);break;case Big :newRoom=getRoomByType(Big);break;newOrder-room = newRoom;insertToOrderList(newOrder);printf(房间号为:%dn,newOrder-room-roomNum);GUI = CheckinResultUI;void showCheckinResultUI()int chooseNum;printf(nn=酒店入住登记确认菜单=tnnn);printf(ttt*ttttn);printf(ttt* 登记成功 *ttttn);printf(ttt*ttttnn);printf(nn=酒店入住登记确认菜单=tnnn); printf(按 0 :返回 n);scanf(%d,&chooseNum);switch(chooseNum)case 0:GUI = MainUI;break;default:GUI = CheckinResultUI;break;void showOrderUI() int roomNum;int chooseNum;int amount;Order * theOrder = NULL;system(cls);printf(nn=酒店房间信息查询菜单=tnnn);printf(请输入房间号:);scanf(%d,&roomNum);if (roomNum100) printf(n 输入有误请重新输入) ; GUI = OrderUI;elsetheOrder = getOrderByRoomNum(roomNum);printf(房型:);switch(theOrder-room-roomType)case Single:printf(单人房n);break;case Double:printf(双人房n);break;case Big:printf(大床房n);break;printf(计费方式:);switch(theOrder-checkinInfo-countType )case Hour:printf(小时计费n);amount = (time(0) - theOrder-date) / 3600 +1;printf(已入住时间:%d小时n,amount);break;case Day:printf(天
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025内蒙古呼和浩特市玉泉区消防救援大队招聘4人模拟试卷及答案详解(各地真题)
- 2025年湖南永州东安县人民法院招聘4名编外聘用制审判辅助人员模拟试卷及答案详解(全优)
- 2025江苏南通市公安局招聘警务辅助人员66人模拟试卷(含答案详解)
- 2025湖南新宁县招聘教师30人模拟试卷及1套完整答案详解
- 2025南平市延平区疾病预防控制中心招聘驾驶员模拟试卷附答案详解(考试直接用)
- 2025年枣阳市事业单位公开招聘206名工作人员考前自测高频考点模拟试题及1套参考答案详解
- 反恐自我防护知识培训课件
- 2025福建龙岩市上杭县富明劳务派遣有限公司招聘拟聘考前自测高频考点模拟试题及完整答案详解一套
- 2025国能包头煤化工有限责任公司高校毕业生招聘人员考前自测高频考点模拟试题及参考答案详解一套
- 2025年4月陕西汉中市中心医院招聘120指挥平台接线员2人考前自测高频考点模拟试题及1套完整答案详解
- 《孤独的小螃蟹》课件
- 0-9任意四位数手机密码排列组合全部数据列表
- 吉林省长春市长春实验中学2024-2025学年高一上学期第一次月考数学试题(无答案)
- 草莓种植课件-幼儿园大班
- 历届中国数学奥林匹克(CMO)试题集(1986-2019)
- 中药新药研发与创新
- 联化科技(临海)有限公司年产800吨二酰胺酯、500吨甲氧苯硼酸、1000吨LT228等九个项目环境影响报告
- 丽江区域地质报告 -报告
- 偏瘫患者业务查房课件
- JJG 1036-2022电子天平
- 杆塔基础分坑
评论
0/150
提交评论