资源描述:
《c语言课程设计宾馆管理信息系统.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、数据结构体:文件名:Structs.h相应的实现:#include#include#include#defineFLOORNUMBER5#defineROOMNUMBER10//房间类型枚举型typedefenumroom_type{Single=1,Double=2,Luxury=3}RoomType;//房间信息结构体typedefstructroom_info{intNum;RoomTypeRoomtype;charLocal[40];intRflag;floatPrice;charTa
2、g[40];}Room;//顾客信息结构体typedefstructguest_info{charName[20];charID[20];charSex;}Guest;//客房信息结构体typedefstructguestandroom_info{intrNum;chargID[20];charCheckinTime[30];charCheckoutTime[30];floatdebt;floatdiscount;floatpay;}GAR;externintGuestNum;floatIncome;intdatin;intdatbook;intda
3、troom1,datroom2,datroom3;charTtype[3][10]={"Single","Double","Luxury"};RoomRooms[FLOORNUMBER*ROOMNUMBER];//房间信息数组GuestGuests[FLOORNUMBER*ROOMNUMBER];//客户信息数组GARGARs[FLOORNUMBER*ROOMNUMBER];//客房信息数组1.初始化模块:对房间信息数组、客户信息数组、客房信息数组进行初始化,即从文件中读取相关信息。文件名:Initialize.c函数名voidInitialize(
4、);相应的函数实现:#include"Structs.h"voidLoadRoomInfo()//房间信息初始化{FILE*fp;if((fp=fopen("RoomInfo.txt","r"))==NULL){printf("Can'topenthefileofRoomInfo!");exit(0);}chartemp[5][8];fprintf(fp,"%s%s%s%s%s",temp[0],temp[1],temp[2],temp[3],temp[4]);intiCount;for(;iCount5、R;iCount++){fprintf(fp,"%d%d%s%d%s",Rooms[iCount].Num,Rooms[iCount].Roomtype,Rooms[iCount].Local,Rooms[iCount].Rflag,Rooms[iCount].Tag)Tag;}printf("房间信息初始化成功.");}voidLoadGuestInfo()//客户信息初始化{FILE*fp;if((fp=fopen("GuestInfo.txt","r"))==NULL){printf("Can'topenthefileofGuestInfo
6、!");exit(0);}chartemp[3][8];fprintf(fp,"%s%s%s",temp[0],temp[1],temp[2]);intiCount;for(;iCount7、t","r"))==NULL){printf("Can'topenthefileofGARInfo!");exit(0);}chartemp[7][8];fprintf(fp,"%s%s%s%s%s%s%s",temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6]);intiCount;for(;iCount8、gID,GARs[iCount].CheckinTime,GARs[iCount].CheckoutTime