酒店管理系统代码

上传人:正** 文档编号:42023903 上传时间:2018-05-31 格式:DOCX 页数:12 大小:23.20KB
返回 下载 相关 举报
酒店管理系统代码_第1页
第1页 / 共12页
酒店管理系统代码_第2页
第2页 / 共12页
酒店管理系统代码_第3页
第3页 / 共12页
酒店管理系统代码_第4页
第4页 / 共12页
酒店管理系统代码_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《酒店管理系统代码》由会员分享,可在线阅读,更多相关《酒店管理系统代码(12页珍藏版)》请在金锄头文库上搜索。

1、#include #include #include #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 RoomOrder CheckinIn

2、fo *checkinInfo; /入住信息 long date; /入住时间 Room * room; /房间信息 Order;typedef struct HotelInfomation int checkinAmount; /已入住房数 int singleRemainAmount; /单人房剩余房数 int doubleRemainAmount; /双人房剩余房数 int bigRemainAmount; /大床房剩余房数 HotelInfo;/-枚举类型- enum MainUI,HotelInfoUI,CheckinUI,CheckinResultUI,OrderUI,CheckO

3、utUI,Exit;/GUI enum Single,Double,Big;/Room Type enum Hour,Day;/countType/-全局变量-int GUI = MainUI;Order* orderList100;/订单数组 Room* roomList100;/房间数组 HotelInfo * hotelInfo = NULL;/酒店房间信息/-函数声明- void initiallizeRoomList(); void insertToOrderList(Order * order);Room* getRoomByType(int roomType); Order* g

4、etOrderByRoomNum(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; hotelInf

5、o - 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: showCh

6、eckinResultUI(); 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;room

7、Listi-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)

8、 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;

9、ichecked = 0) roomListi-checked=1; hotelInfo-bigRemainAmount -; hotelInfo-checkinAmount+; return roomListi; break; /将订单放入订单列表 void insertToOrderList(Order * order) int i; for( i = 0;iroom-roomNum = roomNum) return orderListi; void showMainUI() /显示主界面,并接受输入 int chooseNum;system(“cls“);printf(“nn=酒店房间

10、登记与计费管理管理系统 =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“,switch(chooseNum) case 1: GUI = HotelInfoUI; b

11、reak; 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

12、(“*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“,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=酒店

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号