C语言程序设计酒店管理系统实验报告

上传人:痛*** 文档编号:104291636 上传时间:2022-06-10 格式:DOC 页数:30 大小:502KB
收藏 版权申诉 举报 下载
C语言程序设计酒店管理系统实验报告_第1页
第1页 / 共30页
C语言程序设计酒店管理系统实验报告_第2页
第2页 / 共30页
C语言程序设计酒店管理系统实验报告_第3页
第3页 / 共30页
资源描述:

《C语言程序设计酒店管理系统实验报告》由会员分享,可在线阅读,更多相关《C语言程序设计酒店管理系统实验报告(30页珍藏版)》请在装配图网上搜索。

1、- .课程设计报告书题 目:酒店管理系统设计报告专 业: 电子信息工程移动互联网 班 级: 一班姓 名: 韩国齐学 号: 0 教 师: 朴海光 一:程序功能酒店系统管理包括:主菜单、查看客房入住情况、登记入住、修改客房信息、修改客房信息及退房六个功能模块。每个功能用一个函数来实现,从而到达功能的模块化。主菜单模块:主菜单模块包括1.查看客房入住情况、2.登记入住、3.客房信息修改、4. 退房及显示入住的总费用、5.返回主菜单、6.直接退出程序。 1查看客房入住情况功能模块:主要功能是查看房间的入住情况和继续查看已入住的房间的客户信息。2登记入住功能模块:采用构造体数组来记录客户的信息,包括XX

2、、性别、年龄、XX号、入住时间,入住单价及入住人数,登记完一个房间后可选择继续下一个房间的登记,也可以选择返回主菜单进展其他功能的操作。3修改客房信息功能模块:包括修改客户信息模块和修改房间信息模块。4修改客户信息模块:主要功能是可选择性的修改客户某个信息,也可以一次性全部修改。5修改客房信息功能模块:用来对客户换房时对客户信息和房间号的修改。实现的功能是只要输入客户以前住的房间号和现在想住的房间号, 就将客户的信息全部移到现在想住的房间上,而以前的房间将被置为未使用。6退房及显示总费用功能模块:当客户退房时,将客户使用的客房置为未使用,删除客户信息。并且显示客户从入住到退房时的总费用。 二:

3、程序代码#include#include#include#define M 80int j,s;int hj81=0;FILE *fp; /定义文件指针变量struct date /定义构造体类型int month;int day;int year;final;struct clientchar name20;int sex;int age;char ID_card20;int count;struct date start;struct hotelint price;int room_ID;struct client personal;roomM;void save(); /声明文件函数vo

4、id check_siru(); /声明查看客房入住情况函数void registration_live(); /声明登记入住信息函数void modify_infor(); /声明修改客房信息函数void amend_one(); /声明修改个人信息函数void amend_room(); /声明修改房间信息函数void cost(); /声明退房及显示入住费用函数void get_back(); /声明返回主菜单函数void check_siru1(); /声明查看客房入住情况的调用函数void registration_live1(); /声明登记入住信息的调用函数void amend_

5、one1(); /声明修改个人信息的调用函数void amend_room1(); /声明修改房间信息的调用函数void cost1(); /声明显示入住费用的调用函数 int main() /主函数int menu();void print_message();printf(nnnnn);print_message();menu();save();return 0;void print_message()printf(ttt 欢送入住黄金酒店nnn);menu() /主菜单函数int n;printf(n);printf(ttt 主菜单 nn);printf(ttt 按 1 查看客房入住情况

6、n);printf(ttt 按 2 登记入住信息n);printf(ttt 按 3 修改客房信息n);printf(ttt 按 4 退房、及显示入住费用n);printf(ttt 按 5 返回主菜单n);printf(ttt 按 6 退出程序n);printf(nt请输入要进展操作的选项1、2、3、4、5、6: );scanf(%d,&n);while(n6)printf(ttt 输入错误,请重新输入选项!);scanf(%d,&n);switch(n)case 1:check_siru();break;case 2:registration_live();break;case 3:modif

7、y_infor();break;case 4:cost();break;case 5:get_back();break;case 6:exit(0);return 0;void check_siru() /查看房间使用情况函数int a,g,count=0;for(g=1;g=80;g+)if(hjg=0)+count;elseif(hjg=1)printf(nttt正在使用的房间号:%d,g);printf(nnttt未使用的房间数:%d,count);printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&a);switch(a) case 1:menu();b

8、reak; case 2: printf(nn); printf(nttt请输入要查询的房间号: ); scanf(%d,&s); if(hjs=1) printf(nttt XX:%s,rooms.personal.name); printf(nttt性别其中:1表示男,2表示女!:%d,rooms.personal.sex); printf(nttt 年龄:%d,rooms.personal.age); printf(ntttXX号:%s,rooms.personal.ID_card); printf(nttt入住年份:%d,rooms.personal.start.year); prin

9、tf(nttt 月:%d,rooms.personal.start.month); printf(nttt 日:%d,rooms.personal.start.day); printf(nttt 房间号:%d,rooms.room_ID); printf(nttt客房单价:%d,rooms.price); printf(nttt入住人数:%d,rooms.personal.count); printf(nnttt按 1 返回主菜单,按 2 继续n); scanf(%d,&a); switch(a) case 1:menu();break; case 2:check_siru1();break;

10、 elseprintf(nttt该房间未被使用!);save();printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&a);switch(a) case 1:menu();break; case 2:check_siru1();break;void registration_live() /登记入住函数int a;printf(tt请输入登记的相关信息:n);printf(nttt房间号);scanf(%d,&j);roomj.room_ID=j;printf(nttt XX:);scanf(%s,roomj.personal.name);printf(nt性别

11、其中:1表示男,2表示女!:);scanf(%d,&roomj.personal.sex);printf(nttt 年龄:);scanf(%d,&roomj.personal.age);printf(ntttXX号:);scanf(%s,roomj.personal.ID_card);printf(nttt入住年份:);scanf(%d,&roomj.personal.start.year);printf(nttt 月份:);scanf(%d,&roomj.personal.start.month);printf(nttt 日期:);scanf(%d,&roomj.personal.start

12、.day);printf(nttt客房单价:);scanf(%d,&roomj.price);printf(ntt 请输入入住人数: );scanf(%d,&roomj.personal.count);hjj=1;save();printf(nntt按 1 返回主菜单,按 2 继续: );scanf(%d,&a);switch(a) case 1:menu();break; case 2:registration_live1();break;void modify_infor() /修改客房函数int r,m;printf(ttt 菜单 nnn);printf(ttt1:修改客户信息n);pr

13、intf(ttt2:修改房间信息n);printf(ttt3:返回主菜单n);printf(ttt4:退出程序n);printf(nntt 请选择输入选项1、2、3、4: );scanf(%d,&m);if(m3)r=1;else r=0;switch(m)case 1:amend_one1();break;case 2:amend_room1();break;case 3:menu();case 4:exit(0);save();void amend_one() /修改客人信息函数int i,q;char a20;printf(nnttt请输入现住的房间号: );scanf(%d,&j);p

14、rintf(nttt请选择您要修改的个人选项n);printf(ttt1:代表XX nttt2:代表性别其中1表示男,2表示女 nttt3:年龄 nttt4:代表XX号 nttt5:代表入住年份 nttt6:代表入住月份 nttt7:代表入住日期 nttt8:入住人数n);printf(ttt请选择输入选项1、2、3、4、5、6、7、8: );scanf(%d,&q);switch(q)int t,p;case 1:printf(nttt请输入新名字: );scanf(%s,a);strcpy(roomj.personal.name,a);printf(nnttt按 1 返回主菜单,按 2 继

15、续: );scanf(%d,&i);switch(i) case 1:menu();break; case 2:amend_one1();break;case 2:printf(ntt请输入新性别其中:1表示男,2表示女: );scanf(%d,&p);roomj.personal.sex=p;printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&i);switch(i) case 1:menu();break; case 2:amend_one1();break;case 3:printf(nttt请输入年龄: );scanf(%d,&p);roomj.pers

16、onal.age=p;printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&i);switch(i) case 1:menu();break; case 2:amend_one1();break;case 4:printf(nttt请输入新XX号: );scanf(%s,roomj.personal.ID_card);printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&i);switch(i) case 1:menu();break; case 2:amend_one1();break;case 5:printf(nttt请输入新年

17、份: );scanf(%d,&p);roomj.personal.start.year=p;printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&i);switch(i)case 1:menu();break;case 2:amend_one1();break;case 6:printf(nttt请输入新月份: );scanf(%d,&p);roomj.personal.start.month=p;printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&i);switch(i)case 1:menu();break;case 2:ame

18、nd_one1();break;case 7:printf(nttt请输入新日期: );scanf(%d,&p);roomj.personal.start.day=p;printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&i);switch(i)case 1:menu();break;case 2:amend_one1();break;case 8:printf(nttt请输入新入住人数: );scanf(%d,&p);roomj.personal.count=p;printf(nnttt按 1 返回主菜单,按 2 继续: );scanf(%d,&i);switc

19、h(i)case 1:menu();break;case 2:amend_one1();break;menu();void amend_room() /修改房间信息函数int a,l,x;printf(ntttt请输入你要修改的 客房信息nn);printf(tttt1:房间号nntttt2:客房单价nntttt3:入住人数nntttt4:返回nn);printf(ttt请选择输入选项1、2、3、4: );scanf(%d,&l);switch(l)case 1:printf(nttt请输入旧房号: );scanf(%d,&j);printf(ttt请输入新房号: );scanf(%d,&s)

20、;strcpy(rooms.personal.name,roomj.personal.name);/roomj.personal.name=0;rooms.personal.sex=roomj.personal.sex;roomj.personal.sex=0;rooms.personal.age=roomj.personal.age;roomj.personal.age=0;strcpy(rooms.personal.ID_card,roomj.personal.ID_card); /roomj.personal.ID_card=0;rooms.personal.start.year=roo

21、mj.personal.start.year;roomj.personal.start.year=0;rooms.personal.start.month=roomj.personal.start.month;roomj.personal.start.month=0;rooms.personal.start.day=roomj.personal.start.day;roomj.personal.start.day=0;rooms.room_ID=s;rooms.price=roomj.price;rooms.personal.count=roomj.personal.count;hjs=1;h

22、jj=0;printf(nntt按 1 返回主菜单,按 2 继续: );scanf(%d,&a);switch(a)case 1:menu();break;case 2:amend_room1();break;case 2:printf(nttt 请输入房号: );scanf(%d,&s);printf(ttt请输入新单价: );scanf(%d,&x);rooms.price=x;printf(nntt按 1 返回主菜单,按 2 继续: );scanf(%d,&a);switch(a)case 1:menu();break;case 2:amend_room1();break;case 3:

23、printf(nttt 请输入房号: );scanf(%d,&s);printf(ttt请输入新入住人数: );scanf(%d,&x);rooms.personal.count=x;printf(nntt按 1 返回主菜单,按 2 继续: );scanf(%d,&a);switch(a)case 1:menu();break;case 2:amend_room1();break;case 4:break;save();menu();void cost() /退房、显示入住费用函数int a,i,sum;printf(ttt请输入房间号: );scanf(%d,&j);roomj.room_I

24、D=j;printf(nttt 入住年份:%d,roomj.personal.start.year);printf(nttt 月:%d,roomj.personal.start.month);printf(nttt 日:%d,roomj.personal.start.day);printf(nttt 房间单价为: );printf(%d,roomj.price);printf(nttt请输入退房时间: );printf(nttt 请输入年份: );scanf(%d,&final.year);printf(nttt 请输入月份: );scanf(%d,&final.month);printf(n

25、ttt 请输入日期: );scanf(%d,&final.day);printf(nttt请输入入住天数: );scanf(%d,&i);sum=roomj.price*i;printf(nttt 总费用sum=%dn,sum);hjj=0;save();printf(nntt按 1 返回主菜单,按 2 继续: );scanf(%d,&a);switch(a) case 1:menu();break; case 2:cost1();break;void get_back() /返回主菜单的调用函数menu();void check_siru1() /声明查看客房入住情况的调用函数check_s

26、iru();void registration_live1() /声明登记入住信息的调用函数registration_live();void amend_one1() /声明修改个人信息的调用函数amend_one();void amend_room1() /声明修改房间信息的调用函数amend_room();void cost1() /声明显示入住费用的调用函数cost();void save()FILE *fp;int i;if(fp=fopen(客房管理.txt,w+)=NULL)printf(cannot open filen);exit(0);for(i=0;iM;i+)if(fwr

27、ite(&roomi), sizeof(roomM),1,fp)!=1)printf(file write errorn);fflush(fp);fclose(fp);三:运行主菜单功能 登记客户入住信息可以按 2 继续登记下个房间客户的信息查看登记过的客户信息刚刚登记的明的信息已存在 修改客户信息这页修改的是名字,把明改为三这页查看修改的客户信息是否成功已成功的把明改为了三这页继续修改客户信息这里修改的是性别,把刚刚的男1改为了女2这里继续查看刚刚修改的性别是否成功这里已经把男1改成了女2依此类推下面的年龄、XX号、入住年份、月份、日期、人数都依此方法修改。修改房间信息这里把刚刚客户三入住的45号房间换成了30号房间查看客户换的房间是否换成功这里已经成功的把45号房换成了30号退房及显示入住总费用模块这里已经退掉了30号房间查看退房是否成功这里已经成功的退出了30号房间,已经没有房间在使用了。 整个酒店管理系统的功能就如上图所示。- . 可修编.

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


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