客房管理系统报告

上传人:ni****g 文档编号:469465703 上传时间:2024-02-14 格式:DOC 页数:22 大小:217.50KB
返回 下载 相关 举报
客房管理系统报告_第1页
第1页 / 共22页
客房管理系统报告_第2页
第2页 / 共22页
客房管理系统报告_第3页
第3页 / 共22页
客房管理系统报告_第4页
第4页 / 共22页
客房管理系统报告_第5页
第5页 / 共22页
点击查看更多>>
资源描述

《客房管理系统报告》由会员分享,可在线阅读,更多相关《客房管理系统报告(22页珍藏版)》请在金锄头文库上搜索。

1、C语言实践应用客房管理系统一.总体设计本程序包含用户登记、统计、查询、修改等四大功能。其中用户登记功能包含用户姓名、性别、年龄、身份证、入住年份、入住月份、 入住日期、房间号、房间电话及房间价格;统计功能包含按性别统计、 按年龄统计及按入住时间(年月日)统计;查询功能包含按房间号查 询、按姓名查询及按性别查询;修改功能包含性别修改、年龄修改、 入住年份修改、入住月份修改及入住日期修改。下面以流程图的形式 展示本程序设计思路:选择用户登记功能是否继续输入用户信息n=2输入n输出1.按性别统 计2按年龄统计3. 按入住日期统计输入i输出1按房间 号2按姓名3.按性别查询n=3n=41n=5功能菜单

2、选择i=1I=2I=3输入II=1输出男 女性别 人数输出各 年龄段 人数输出各 日期段 人数输入姓名退出输出用户信息结束输出1性别2年龄3年份4月份5日期T/ 输入a/ za=1a=2a=3a=4a=51f1rIF1r1 rI=2I=3输入 输入;输入 房间j姓名:;性别输入 输入 输入.:输入 性别.年龄I年份月份输入日期输入kk=1?否输入k是k=1?否1 f是k=1?否二.设计模块一个较大的C语言程序不外乎由多个函数组成,本程序也并不例外。现就本程序中涉及的各个函数的代码和功能分别进行说明。Imain函数 void maI n()ini(); menu();本函数用于调用ini函数和m

3、enu函数(介绍见下文)。2.ini 函数void ini()int i=0;for(;i100;i+)Roomi.sign=false;Roomi.Room_ID=i; 本函数功能为先定义所有的房间为空并依次定义各个房间的序号。3. menu 函数void menu()int n,k;doprintf(1.登记n);printf(2.统计n);printf(3.查询n);printf(4.修改n);printf(5.退出n);printf(Choice your number(1-5):); scanf(%d,&n);if(n5)k=1;puts(Please enter againn);e

4、lse k=0;switch(n)while(k=1);case 1:dengji();break;case 2:tongji();break;case 3:chaxun();break;case 4:xiugai();break;case 5:exit(0);本函数的功能为输出功能菜单选项, 其中包括登记、 统计、查询、修改及退出。系统根据输入的选项调用相应的功能函数。4. dengji 函数void dengji()int k=1,i=0;while(k)printf(Please enter the Name:);scanf(%s,Roomi.Client_list.Name);prin

5、tf( Please enter the Sex, Men 1, Women 2:);scanf(%d,&Roomi.Client_list.Sex);printf(Please enter the Age:);scanf(%d,&Roomi.Client_list.Age);printf(Please enter the ID_card:);scanf(%d,&Roomi.Client_list.ID_card);:);printf(Please enter the yearscanf(%d,&Roomi.Client_list.year);printf(Please enter the m

6、onth: );scanf(%d,&Roomi.Client_list.month); printf(Please enter the date:);scanf(%d,&Roomi.Client_list.date); printf(Please enter the Tel:);scanf(%d,&Roomi.Tel);printf(Please enter the Price: );scanf(%d,&Roomi.Price);Roomi.sign=true;printf(The Room_ID is : %dn,Roomi.Room_ID); i+;printf(Do you want t

7、o continue?, Yes 1, No 0: ); scanf(%d,&k);if(k!=1&k!=0)printf(You have entered the wrong number, please enter againn);printf(Do you want to continue?, Yes 1, No 0: );scanf(%d,&k);menu();本函数的功能为登记用户及房间信息,包括姓名、性别、年龄、 身份证、年份、月份、日期、房间电话及房间价格。系统依次分配房 间号并定义此房间为非空。 管理员可根据具体情况登记相应用户人数 的信息。在此申明由于本程序并未将用户信息存入

8、磁盘, 因此务必先 登记用户信息再执行功能菜单中的其他功能。5. tongji 函数void tongji()int i;printf(1.According to the sex 2.According to theage 3.According to the time:);scanf(%d,&i);if(i!=1&i!=2&i!=3)printf(You have entered the wrong number, please enter againn);tongji();switch(i)case 1: xingbie();break;case 2: nianling();break;

9、case 3: shijian();break;本函数的功能为输出统计功能菜单选项, 包括根据按性别统 计、根据年龄统计及根据入住时间统计。 系统根据输入的选项执行相 应的函数(介绍见下文) 。6. xingbie 函数void xingbie()int i,a=0,b=0,k=0;for(i=0;Roomi.sign;+i)switch(Roomi.Client_list.Sex)case 1:a+;break;case 2:b+;break;printf(Men:%dn Women:%dn,a,b);printf(Do you want to continue? Yes 1, No 0:

10、);scanf(%d,&k);if(k!=1&k!=0)printf(You have entered the wrong number, please enter againn);printf(Do you want to continue?, Yes 1, No 0: ); scanf(%d,&k);if(k) tongji();else menu();本函数的功能为分别输出用户中男女性别的人数。7. nianling 函数 void nianling()int i,a=0,b=0,c=0,k=0;for(i=0;Roomi.sign;i+)switch(Roomi.Client_list

11、.Age/20)case 0:a+;break;case 1:b+;break;default:c+; printf(Age20:%dn20=Age=40:%dn,a,b,c);printf(Do you want to continue? Yes 1, No 0: ); scanf(%d,&k);if(k!=1&k!=0)printf(You have entered the wrong number, please enter againn);printf(Do you want to continue?, Yes 1, No 0: ); scanf(%d,&k);if(k) tongji

12、();else menu();本函数的功能为分别输出用户中年龄在 20岁以下、20至 40 岁及 40 岁以上的人数。8. shijian 函数void shijian()int i,a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0;for(i=0;Roomi.sign;i+)switch(Roomi.Client_list.year)case 2009:a+;break;case 2010:b+;break;for(i=0;Roomi.sign;i+)if(Roomi.Client_list.date=10) c+;elseif(Roomi.Client_lis

13、t.date10) d+;else e+;for(i=0;Roomi.sign;i+)if(Roomi.Client_list.month=3) f+;elseif(Roomi.Client_list.month3) g+;elseif(Roomi.Client_list.month6) h+;else j+;printf(2009:%dn 2010:%dn month=3:%dn3month=6:%dn6month=9:%dn9month=12:%dn date=10:%dn10date=20:%dn20date30:%dn,a,b,f,g,h,j,c ,d,e);printf(Do you want to continue? Yes 1, No 0:);scanf(%d,&k);if(k!=1&k!=0)printf(You have entered the wrong number, pleaseenter againn);printf(Do you want to continue?, Yes 1, No 0: );scan

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

当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号