c语言课程设计 宾馆管理信息系统.doc

上传人:豆**** 文档编号:17404754 上传时间:2022-05-23 格式:DOC 页数:10 大小:220KB
返回 下载 相关 举报
c语言课程设计 宾馆管理信息系统.doc_第1页
第1页 / 共10页
c语言课程设计 宾馆管理信息系统.doc_第2页
第2页 / 共10页
点击查看更多>>
资源描述

《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(%

13、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(%

14、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,&GARsco

15、unt.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 C

16、orrect();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);c

17、hoose=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(输入单价:)

18、;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);br

19、eak;/删除功能模块 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;temp+)

20、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(%d

21、,&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;if(t

22、empFLOORNUMBER*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)break;

23、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(GA

24、Rstemp.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 per;pe

25、r=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(宾馆的经营状况一般!n);elseprintf(宾馆的经营状况较好!n);printf(宾馆经营,要好好加油啊!);

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

当前位置:首页 > 教育专区 > 小学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com