c语言课程设计 宾馆管理信息系统.doc
《c语言课程设计 宾馆管理信息系统.doc》由会员分享,可在线阅读,更多相关《c语言课程设计 宾馆管理信息系统.doc(10页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、【精品文档】如有侵权,请联系网站删除,仅供学习与交流c语言课程设计 宾馆管理信息系统.精品文档.数据结构体:文件名:Structs.h相应的实现:#include#include#include#define FLOORNUMBER 5#define ROOMNUMBER 10/房间类型枚举型 typedef enum room_typeSingle=1,Double=2,Luxury=3RoomType;/房间信息结构体 typedef struct room_infoint Num;RoomType Roomtype;char Local40;int Rflag;float Price;c
2、har Tag40;Room;/顾客信息结构体 typedef struct guest_infochar Name20;char ID20;char Sex;Guest;/客房信息结构体typedef struct guestandroom_infoint rNum;char gID20;char CheckinTime30;char CheckoutTime30;float debt;float discount;float pay;GAR;extern int GuestNum;float Income;int datin;int datbook;int datroom1,datroom
3、2,datroom3;char Ttype310=Single,Double,Luxury;Room RoomsFLOORNUMBER*ROOMNUMBER;/房间信息数组 Guest GuestsFLOORNUMBER*ROOMNUMBER;/客户信息数组 GAR GARsFLOORNUMBER*ROOMNUMBER;/客房信息数组 1.初始化模块:对房间信息数组、客户信息数组、客房信息数组进行初始化,即从文件中读取相关信息 。文件名:Initialize.c函数名void Initialize();相应的函数实现:#includeStructs.hvoid LoadRoomInfo()/房
4、间信息初始化 FILE *fp;if(fp=fopen(RoomInfo.txt,r)=NULL)printf(Cant open the file of RoomInfo!n);exit(0);char temp58;fprintf(fp,%s%s%s%s%s,temp0,temp1,temp2,temp3,temp4);int iCount;for(;iCountFLOORNUMBER*ROOMNUMBER;iCount+)fprintf(fp,%d%d%s%d%s,RoomsiCount.Num,RoomsiCount.Roomtype,RoomsiCount.Local,RoomsiC
5、ount.Rflag,RoomsiCount.Tag)Tag;printf(房间信息初始化成功.n);void LoadGuestInfo()/客户信息初始化 FILE *fp;if(fp=fopen(GuestInfo.txt,r)=NULL)printf(Cant open the file of GuestInfo!n);exit(0);char temp38;fprintf(fp,%s%s%s,temp0,temp1,temp2);int iCount;for(;iCountGuestNum;iCount+)fprintf(fp,%s%s%c,GuestsiCount.Name,Gue
6、stsiCount.ID,GuestsiCount.Sex);printf(客户信息初始化成功.n);/初始化客房信息void LoadGARInfo()FILE *fp;if(fp=fopen(GARInfo.txt,r)=NULL)printf(Cant open the file of GARInfo!n);exit(0);char temp78;fprintf(fp,%s%s%s%s%s%s%s,temp0,temp1,temp2,temp3,temp4,temp5,temp6);int iCount;for(;iCountFLOORNUMBER*ROOMNUMBER;iCount+)
7、fprintf(fp,%d%s%s%s%f%f%f,GARsiCount.rNum,GARsiCount.gID,GARsiCount.CheckinTime,GARsiCount.CheckoutTime,GARsiCount.debt,GARsiCount.discount,GARsiCount.pay);printf(客房信息初始化成功.n);2.经营模块:对顾客的订房、入住、退房等手续进行办理,并同时完成相应后台数据的及时更新与统计。文件名:Run.c函数名:void Bookroom();void Checkin();void Checkout();相应的函数实现:#includeS
8、tructs.h/订房功能模块int Findfree(int type)int i;for(i=0;iFLOORNUMBER*ROOMNUMBER;i+)if(0=Roomsi.Rflag&type=Roomsi.Roomtype)break;return i;void BookRoom()int broom;int freeroom;printf(订房功能:n);printf(请输入房间类型:1.标准单人间 2.标准双人间 3.豪华间n);scanf(%d,&broom);/查询是否有该类型空房间freeroom=Findfree(broom);if(freeroomFLOORNUMBER
9、*ROOMNUMBER)printf(请输入您的信息:n);printf(姓名:);scanf(%s,GuestsGuestNum+1.Name);printf(身份证ID:);scanf(%s,GuestsGuestNum+1.ID);printf(性别:);scanf(%c,GuestsGuestNum+1.Sex);printf(订房完成!n);/完成客户信息后,完成客房信息 strcpy(GARsfreeroom.gID,GuestsGuestNum+1.ID);GARsfreeroom.rNum=(freeroom/10+1)*100+freeroom%10);GuestNum+=1
10、;elseprintf(该类型房间已无空余!n);/入住功能void CheckIn()int choose=0;int iCount;int sign=0;char tID20; printf(你预定房间了吗?1.已预订 2.未预定n);doprintf(请选择:);scanf(%d,&choose);while(choose!=1&choose!=2);if(1=choose)printf(请输入你的身份证号:);scanf(%s,tID); for(iCount=0;iCountFLOORNUMBER*ROOMNUMBER;iCount+)if(strcmp(GARsiCount.gID
11、,tID)=0)printf(请输入入住时间:);scanf(%s,GARsiCount.CheckinTime);sign=1;break;datbook+;elseprintf(请输入您要的房间类型:1.标准单人间 2.标准双人间 3.豪华间n);scanf(%d,&choose);int freeroom=Findfree(choose);if(freeroomFLOORNUMBER*ROOMNUMBER)printf(请输入客户信息:);printf(姓名:);scanf(%s,GuestsGuestNum+1.Name);printf(身份证ID:); scanf(%s,Guests
12、GuestNum+1.ID);printf(性别:);scanf(%c,&GuestsGuestNum+1.Sex);strcpy(GARsfreeroom.gID,GuestsGuestNum+1.ID);GARsfreeroom.rNum=(freeroom/10+1)*100+freeroom*10);sign=1;elseprintf(该类型的房间无空余!n);if(1=sign)printf(入住成功!n);/退房功能模块void CheckOut()int rNum;int count;int count2;int day=0;printf(请输入你入住的房间号:);scanf(%
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- c语言课程设计 宾馆管理信息系统 语言 课程设计 宾馆 管理信息系统
限制150内