资源预览内容
第1页 / 共28页
第2页 / 共28页
第3页 / 共28页
第4页 / 共28页
第5页 / 共28页
第6页 / 共28页
第7页 / 共28页
第8页 / 共28页
第9页 / 共28页
第10页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
酒店管理系统代码ttinelude windowsh #include #includestdioh #include #include/ 结 构 定 义typedef struct Checkininformation char name10;int id;件号int roomType;int countType; Checkininfo;姓名证房型 计费方式typedef struct HotelRoom int roomType;房型int roomNum;/房号int checked;入住情况int price;/房价Room;typedef struct RoomOrderCheckininfo *checkinlnfo; 息long/入住时间Room * room;房间信息Order;/入住信 date;/typedef struct HotellnfomationintcheckinAmount;已入住房数int singleRemainAmount;/单人房剩余房数int doub 1 eRemainAmount;/双人房剩余房数/大床int bigRemainAmount; 房剩余房数Hotellnfo;/枚举类型 enumMainUI, HotellnfoUI, CheckinUI, CheckinResu ItUI, OrderUI, CheckOutUI, Exit:/GUI enum Single, Double, Big;/Room Type enum Hour, Day;/countType/量全局变int GUI 二 MainUI:Order* orderList 100; 订单数组Room* roomList 100;/房间数组Hotelinfo * hotelinfo 二 NULL;/酒店房间信 息/函数声明void initiallizeRoomList();void insertToOrderList(Order * order);Room* getRoomByType(int roomType); Order* getOrderByRoomNum(int roomNum);void showMainUI。;void showH otelInfoUI。;void showCheckinUI。;void showCheckinResultUI();void showOrderUI();void showCheckOutUI。;/数void/主函数hotelInfo-Main 函 main()(HotelInfo*)malloc(sizeof(Hotelinfo);hotelinfo 一 singleRemainAmount 二 20;hotelInfo - doubleRemainAmount=40;hotelInfo - bigRemainAmount=40;hotelInfo - checkinAmount=0;初始化房间列表initiallizeRoomList();界面显示wh订e(GUI != Exit)swi tch(GUI)case MainUI:showMainUI。;break;case HotelInfoUI:showHo telInfoUIO;break;case CheckinUI:showCheckinUIO;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;i20;i+)/ 单人房房间信息初始化newRoom=(Room* )malloc(sizeof(Room);roomListi二 newRoom;roomListi-checked=0;roomListi-price=110;roomListi-roomNum二i+1;roomListi-roomType二Single;for(i=20;i60;i+)/ 双人房房间信息初始化newRoomz(Room* )malloc(sizeof(Room);roomListi二 newRoom;roomListi-checked=0;roomListi-price=180;roomListi-roomNum二i+1;roomListi-roomType二Double;for(i=60;i100;i+)/ 大床房房间信息初始化newRoom=(Room* )malloc(sizeof(Room);roomListi二 newRoom;roomListi-checked=0;roomListi-price=180;roomListi-roomNum二i+1;roomListi-roomType二Big;通过所选择的房型获取空房间,获取房间后将 房间信息改为已入住,并减少相应房型的剩余房 间数Room* getRoomByType(int roomType)int i;switch(roomType)case Single:for(i=0;isingleRemainAmount hotelInfo-checkinAmount+; return roomListi;break;case Double:for(i=20;idoubleRemainAmountIhotelInfo-checkinAmount+; return roomListi;break;case Big:for(i=60;i100;i+)if( roomListi-checked = 0)roomListi-checked=1;hotelInfo-bigRemainAmount -一;hotelInfo-checkinAmount+; return roomListi;寅必咲皐合皆联藝/!jopjo 二iq.siqj9pjo (TlflN二二!再!卩即工0 )jt (+T-00IT-0 二!)珂T HE (jspjo * jspjg) siqjopjo0!-18811! P!OA 峯fi&庚必Y龔庚必#k/Order* getOrderByRoomNum(int roomNum)int i;for(i=0;iroomNum roomNum)return orderListi; void showMainUI。显示主界面,并接受输入int chooseNum;sys te m(cls);printf(nn二二= 酒店房间登记与计费管理管理系统printf(*tttt1 tttt*n);printf(*tttt2 ttt*n);printf(*tttt3 ttt*n);printf(*tttt4 tttt*n);printf(*tttt5 tttt*nnn);tnnn);入住登记查询入住情况查询当前费用结账退房退岀程序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;sys te m(cls);printf(nn二= 店入住情况査询菜单 =tnnnn);printf(*ttt 入 住 房 间 数 : %dtttt*n, hotelInfo-checkinAmount);printf(*ttt 剩余房间数:t);printf( 单 人 房:%dtt*n,hotelInfo-singleRemainAmo unt);printf(*ttttt 双 人 房:%dtt*n,hotelInfo-doubleRemainAmo unt);printf(*ttttt 大 床 房:%dtt*nn,hotelInfo-bigRemainAmou nt);printf(nn= 店入住情况查询菜单 =tnnn);printf (“按 0 :返回 n); printf(按1:登记入住n);scanf(%d,&chooseNum);switch(chooseNum)case 0:GUI = MainUI;b
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号