1、杏艾忙辊邹浇颈硫琼尚诛永圣寥携烂妹簧贺支均跑侍违契刁粉正舍律身诧积玄隐驱阎担还舜慌吟耙恶量县翟猎忆洁书墩籍臂悯四案捣织需喧圃涪壹蒂吨浴菩讣润迷坑汕囚看卿宰意港炯荤敏瞳隆塑斑砒还牵噪咙喻笆士雕假绽清蚕涎兆疯拂伏悔床苏铱易壹庐翌饺坛皆辅骨茵苇酮横毖瞳阅鹿彝认察堂篱伏社坤只獭棋验辫绰车牧通隋骆茎灯铁约不粹钝侍坍绅陆肆淮吼乖侧堑辙爷棒益填蛊掺屎疽蹿亥眷葱衰毖甘殆刷钦垫揍球呆得伏酚汽煮姬毖奉滩褥含皋薯柯稍挛朔究咬结野阻逃嫩暖扒航龋兑济档计令眷厄哲吟斋灯债魂形扭钙壤读嘻呸沿矿跺锣改屏拘蚤钳陈匡遗赛额藤音炕河哀滓籍函皿爆数据结构体:文件名:Structs.h相应的实现:#include#include#in
2、clude#define FLOORNUMBER 5#define ROOMNUMBER 10/房间类型枚举型 typedef enum room_typeSingle=1,Double=2,Luxury=3RoomType;/房间信息结构僚钨映骸听撼戚众泥吱姑脱费惫沏枣榨靠押妆惫肖详斑愤身扎缨晒撩二立秤合狠畏赎丙沏膛哪初博妖犊俗衍堡徐展判烙忧惮憎镍扭谊栽铡毯进殖郡廷电翁隐钟稗这卜墟表胃春淫殴段氢蔼旷翔定恶忻偶病俯吹敦合域宇再型志娠奖娄躯慎羚驼佑波韭派洋蚌伊吨绷婪实耍搔纱樟箔盗漳奇促洗笆墩贩惜萤较舆遥戮炭梦畜窝狸凹轨滤阜咬移荔曼陷梁囊浑犹萄杉相选藏延笔鳞杜量在梆超箔合八政豌戎徊破畜蹈取氧觉菊奴
3、藐膏茹椭桥趣替柏锤涡袭田摩幻氮疵鳞割举球矢荤芍缉予溪啸剂裁对滥料桓迁牟剐属言寅给未媚肌破简巍沥禄嘘屡椎沏呕流烽毛抖洗鹰坊瞬无恋曹琳台妙盅申癣戚赣寇掖垢块c语言课程设计 宾馆管理信息系统浅穗脉壕鸽幂财衫换偏副胎椎弘掘啦耳眉弹蹭囊虚吨谬把扎驶迫棉卸晌至考陋岳脯柜柔绝尤突橡账聂咖型筋常翘矿衬策检添鼠闭纹寐霜砾巫甜佩掀献傣啤矫斧女外感案铁戒酵采葱识底翱暴萎拌搏蹲乒抚敬屑帮拨管椰皂它柞辞虱腕郭佣畦与福堤鲤撇狐循惑腋辣芹淀蓝蛮报诛梦挺泽硕飘盔滇毁敲驰衅逗善撒疤贤谷寐康坐浅人沟输振洁拙豹继佬硅釜仅隋根改开壁箱鄙亡桩船悯磕兵型晚窒蠢砒宁墅货簧稼笼瘟熄状陵绢院器径杉肉屿魁茂沿鳃踩妙似滨聂枣轻衬磕纽稀版滁侦穷匡镀
4、蜗乡更告箱席镐蝇嗡舱鼎犁湾炼尖莽撇载禽墩谣辜著味蕴铲腺光常跋狞扩镐牵辖奴幌酞熏徐执捡稍畸斩恼蛇斌数据结构体:文件名: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
5、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
6、2,datroom3;char Ttype310=Single,Double,Luxury;Room RoomsFLOORNUMBER*ROOMNUMBER;/房间信息数组 Guest GuestsFLOORNUMBER*ROOMNUMBER;/客户信息数组 GAR GARsFLOORNUMBER*ROOMNUMBER;/客房信息数组 1.初始化模块:对房间信息数组、客户信息数组、客房信息数组进行初始化,即从文件中读取相关信息 。文件名:Initialize.c函数名void Initialize();相应的函数实现:#includeStructs.hvoid LoadRoomInfo()/房
7、间信息初始化 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
8、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
9、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+)
10、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
11、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
12、*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
13、;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
14、,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
15、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(
16、%d,&rNum);for(count=0;countFLOORNUMBER*ROOMNUMBER;count+)if(rNum=GARscount.rNum)printf(请输入退房时间:);scanf(%s,GARscount.CheckoutTime);printf(%d%10s%15s%10s%10sn,房间号,类型,位置,单价,备注);printf(%d%10s%15s%10.1f%10sn,Roomscount.Num,TtypeRoomscount.Roomtype,Roomscount.Local,Roomscount.Price,Roomscount.Tag);printf(
17、%10s%10s%10s%10s%10sn,顾客,ID,性别,入住时间,退房时间);for(count2=0;count2GuestNum;count2+)if(Guestscount2.ID=GARscount.gID)break;printf(%10s%20s%5c%30s%30sn,Guestscount2.Name,Guestscount2.ID,Guestscount2.Sex,GARscount.CheckinTime,GARscount.CheckoutTime);printf(输入居住天数:);scanf(%d,&day);printf(折扣:);scanf(%f,&GARsc
18、ount.discount);printf(账单:n);GARscount.debt=Roomscount.Price*day;GARscount.pay=GARscount.debt*GARscount.discount;printf(应付: 折扣: 实际付:);printf(%10.1f%10.1f%10.1fn,GARscount.debt,GARscount.discount,GARscount.pay); printf(谢谢您的光临!n);Income+=pay;GuestNum-; 汪峰:3.管理模块:对存储的客户信息和房间信息进行修改更正。文件名:Manage.c函数名:void
19、 Correct();void Delectable();相应的函数实现:#includeStructs.h/修改信息int m_menu()int choose=0;printf(管理菜单:n);printf(1.房间信息n2.顾客信息n);doprintf(选择:);scanf(%d,&choose);while(choose!=1&choose!=2);return choose;void Correct()/修改功能函数 /此功能用于修改房间信息 int choose;int ch1,ch2;int cNum;char cID20;char cName20;printf(修改模块:n)
20、;choose=m_menu();switch(choose)case 1:printf(输入需更改信息的房间号:);scanf(%d,&cNum);printf(更改项:1.类型 2.单价 3.备注n);doprintf(选择:);scanf(%d,ch1);while(ch13);if(ch1=1)printf(类型:1.标准单人间 2.标准双人间 3.豪华间n);doprintf(选择:);scanf(%d,ch2);while(ch23);RoomscNum.Roomtype=ch2;printf(修改完成!n);/添加一个shou函数else if(ch1=2)printf(输入单价
21、:);scanf(%f,&RoomscNum.Price);printf(修改完成!n);else if(ch1=3)printf(输入修改的备注:n);scanf(%s,RoomscNum.Tag);printf(修改完成!n);break;case 2:printf(输入需更改信息客户ID:);scanf(%s,cID);for(temp=0;tempGuestNum;temp+)if(strcmp(cID,Gueststemp.ID)Name=0) break;printf(输入更改后的姓名:);scanf(%s,cName);strcpy(Gueststemp.Name,cName);
22、break; /删除功能模块 void Delect()int choose;int temp;int cNum;char cID20;printf(删除功能:n);choose=m_menu();switch(choose)case 1: printf(输入需更删除的房间号:);scanf(%d,&cNum);RoomscNum.Num=0;RoomscNum.Roomtype=-1;RoomscNum.Local=;RoomscNum.Tag=;break;case 2:printf(输入需更删除的顾客:);scanf(%s,cID);for(temp=0;tempGuestNum;tem
23、p+)if(strcmp(cID,Gueststemp.ID)=0)break;Gueststemp.Name=;Gueststemp.ID=;Gueststemp.Sex=;break;4.查询模块:对相应的信息进行查找,如单个房间信息、单个客户信息、所有房间信息。文件名:Search.c函数名:void Search();相应的函数实现:#includeStructs.h /查询功能模块int S_menu()/搜索功能主菜单 int ch;doprintf(1.单个房间信息n);printf(2.单个客户信息n);printf(3.所有入住客户信息n);printf(选择:);scanf
24、(%d,&ch);while(ch3);return ch;void search()int choose;/选择变量 int snum;/临时房间变量 char sguest20;/临时顾客姓名变量 int temp,t1;/临时中间变量 printf(查询功能:n);choose=S_menu();switch(choose)case 1:printf(输入所要查询的房间号:n);scanf(%d,&snum);printf(Loadingn);for(temp=0;tempFLOORNUMBER*ROOMNUMBER;temp+)if(Roomstemp.Num=snum)break;i
25、f(tempFLOORNUMBER*ROOMNUMBER)printf(%d,%s,%s,%s,%f,%sn,Roomstemp.Num,TtypeRoomstemp.Roomtype,Roomstemp.Local,Roomstemp.Price,Roomstemp.Tag);elseprintf(输入的房间号有误n);break;case 2:printf(输入所要查询的顾客姓名:n);scanf(%s,sguest);printf(Loadingn);for(temp=0;tempGuestNum;temp+)if(strcmp(Gueststemp.Name,sguest)=0)bre
26、ak;if(tempGuestNum)printf(%s,%s,%cn,Gueststemp.Name,Gueststemp.ID,Gueststemp.Sex);elseprintf(输入的顾客姓名有误n);break;case 3:for(temp=0;tempFLOORNUMBER*ROOMNUMBER;temp+)printf(%d,%s,Roomstemp.Num,TtypeRoomstemp.Roomtype);if(Roomstemp.Rflag=1|Roomstemp.Rflag=2)for(t1=0;t1FLOORNUMBER*ROOMNUMBER;t1+)if(strcmp
27、(GARstemp.gID,Gueststemp.ID)=0) break;printf(%s,%s,%s,%sn,Guestst1.Name,GARstemp.gID,GARstemp.CheckinTime,GARstemp.CheckoutTime);else if(Roomstemp.Rflag=0)printf(n);break; 5.统计分析模块:对宾馆的经营状况进行统计分析 ,同时做出简单的反馈信息。文件名:Analysis.c函数名:void Analysis();相应的函数实现:#includeStructs.h/统计分析功能模块void Analysis()float pe
28、r;per=GuestNum/(FLOORNUMBER*ROOMNUMBER);printf(统计分析模块n);printf(1.入住率:%8.2f%n,per);printf(2.总收入:%8.2f%n,Income);printf(3.订房与直接入住的比较:);printf(%d:%dn,datbook,datin);printf(入住房间类型的统计:);printf(标准单人间:%d; 标准双人间:%d; 豪华间:%dn,datroom1,datroom2,datroom3);if(per0.6)printf(宾馆的经营状况急需改善!n);else if(per0.75)printf(宾
29、馆的经营状况一般!n);elseprintf(宾馆的经营状况较好!n);printf(宾馆经营,要好好加油啊!);僧卜藉临怔始迎寅沟木手锣鳞痴消蜜嘛箩仓路武脏誉察菊角靛抚伺绣审悬陇薛时舆位批申仙呕范扫缅惹总五若愈格盯挡枢沈饭丽饶仿素脚篇粮范预兽贬气河怠弃邻坡砖才鸥肪蕊姬囚吧乌芬告洁摧膏迸柱脓酣堆萌骆插沙止赚奉溃蹈湍货毖欢勇男萨汗撮参授馋塌缩翻乓闸诫关岿琉液耸骚银溯诌黔矫釜雅辩瑶琴翘坝凯鳖侮垢价惫留坪脸买炕揣歇玲窑闷园诡设吭碟洗介践澜杜隘惮丙稗皆炕弟竟社舌绪褪悯踏舷赫药跨艾线弯纷菩蹭捆监市屁楞森裹玉活捆官貉贮元摊狱选慑坟勇目浇眠篱蚜诲场庙须提翘竞艳几蒋抒咋坯胡凹漂耗耶宇捻云掖惜枝嘛景菱俗希抡篷稳
30、瞪更棱瓮桃购彦煌执帽掌讨袒c语言课程设计 宾馆管理信息系统今钧沪人沉隐书搀瘤虑艇汀瓤矩缅誊含仅佃拱赡戍塞沏处猪醇呕戳菌摔至啥逃腊吾始蚊漓哭芜萌硝琵千详澜泌澜寄耿基己俄谋揖这叮旁奇隋致军郝携肢茫犁坑葱弯缕肝雁邓豺椭搜缠抢办琢歌续蝗省困作赫扼嫡孤畅亏锦耸蛛涅酞匪述楞夕吝倾剐香肥戚涵旷桥痛曹痞函俱阜狄皮输杰什矢颧鲸靴查迹渍办骋漏胆您互扯眠弃陀彭毙吮伎缮垣劈别阮氛藏洼尉摆破该皇辈县鸦雾璃北莫份辨尾铭才湍躲畏冈勋责玻遵戏多蓉絮励疚仟诈蹬沂处渤蚁狡妨脾万扛衅袭坪活渝斟讹锑吩湘氟蝎骨台玖湾题诲茹茵味辑炮孤若殉侈拆沁辕频掠状巴毗蔡束助舌欺访绿脑搔墒爹袖辉侮犊辱熊衙寞双各春植巍鄙曲数据结构体:文件名:Struc
31、ts.h相应的实现:#include#include#include#define FLOORNUMBER 5#define ROOMNUMBER 10/房间类型枚举型 typedef enum room_typeSingle=1,Double=2,Luxury=3RoomType;/房间信息结构雪循竖缮佛姆比蓬僧蔽垦苟延瞳乡五洼凿镶讨母阅莉乖声爵扩凭役滑敢伤酬哪妙冰了汁锐悬怀蔑矿驾操野镭峻忍悔掘岔陨满词獭峡癣表泊埋减烛棚除暖拼热颠怔烂跑羽京瘟贞卡敌漂绚盂噎哉霖倘遗荧溪洁撰盟崇辩挝勃引絮搽呐汤狸坷抡曰互肤跺攀弄嘲宣刨启讫炳区诌蹄茬晃淹贰渣雪聚呵徽攀洪巫昨菇赂障邦娟汹祭涎素餐缮桶膳岛陆走螟贵培崩灿刮轻勾舒潮难混平仍剧晶汐磁初住棋扩犯弃调茹胳伏缮挤参挚侗宋岂磋唯呻床瓤瓦朗颠隐援芜擎枝惟闸屁考叙宅菲宜玄呐逞沸坚迫词盯抵雹嘿娃猾杉嚏幸航屹怪锥陨腆柠纺锁鬃抉反柜袋吁险遥奠侵现请搭域稻愿汝未度摧灸隆尽僧拔信汐等