ImageVerifierCode 换一换
格式:DOC , 页数:17 ,大小:65KB ,
资源ID:4520583      下载积分:5 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/4520583.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(C语言课程设计报告酒店房间登记及计费管理系统源代码.doc)为本站上传会员【二***】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

C语言课程设计报告酒店房间登记及计费管理系统源代码.doc

1、 - 酒店房间登记与计费管理系统源代码 #define M 80 #include #include #include /*函数声明*/ void check_in(); /*登记入住函数*/ void chamber(); /*入住情况函数*/ void price();

2、 /*当前费用函数*/ void fee(); /*结账退房函数*/ void infor(); /*信息查询函数*/ void save(int); /*保存信息函数*/ void read(int); /*读取信息函数*/ void choice(); /*功能选择函数*/ int judge_year(int); /*判断闰年函数*/ void information(); /*输出全部房间信息*/ /*构造体*/ struct time

3、 {int year; int mon; int date; int hour; }; struct room /*定义各房间信息的构造体*/ {char name[40]; char ID[18]; int flag; /* 0-无人入住,1-按小时计费,2-按天计费 */ long int deposit; time t[2]; /* 0-入住时间,1-当前时间 */ }room[M]; char c1[40]={0}; char c2[18]={0}; /*主函数

4、〔主界面〕*/ void main() {system("cls"); /*清屏*/ system("color 4E"); int n; printf("********************************************************************************"); printf("** **"); printf("**\t\t -----

5、 欢送光临万豪酒店 ---------- **"); printf("** **"); printf("********************************************************************************\n\n"); printf("\t\t\t [ 1. 登记入住 ]\n\n"); printf("\t\t\t

6、 [ 2. 入住情况 ]\n\n"); printf("\t\t\t [ 3. 当前费用 ]\n\n"); printf("\t\t\t [ 4. 结账退房 ]\n\n"); printf("\t\t\t [ 5. 信息查询 ]\n\n"); printf("\t\t\t [ 6. 全部信息 ]\n\n"); printf("\t\t\t [ 7. 退出系统 ]\n\n"); printf("请输入您需要的效劳的代码:"); scanf("%d",&n); wh

7、ile(n<1||n>7) {printf("\n\n代码输入有误,请您重新输入:"); scanf("%d",&n); } switch(n) /*根据输入数字选择功能*/ {case 1:check_in();break; /*调用登记入住函数*/ case 2:chamber();break; /*调用房间情况函数*/ case 3:price();break; /*调用当前费用函数*/ case 4:fee();break;

8、 /*调用结账退房函数*/ case 5:infor();break; /*调用信息查询函数*/ case 6:information();break; /*调用全部信息函数*/ case 7:exit(0); /*调用退出系统函数*/ } } /*查看房间使用情况函数*/ void chamber() {system("cls"); /*清屏*/ system("color 4E"); pri

9、ntf("\n**********************************房间使用情况**********************************\n"); int count=0; int i; int j; int k; int m; for(i=1;i<=80;i++) /*统计未入住房间总数*/ {read(i); if(room[i-1].flag==0) count++;} printf("当前未使用房间数:%d\n\n\n",count); chaxun: printf("请输入你要查询的房间号〔1-40:单

10、人间,41-80:双人间〕:"); /*输入房间号查询房间入住情况*/ scanf("%d",&m); while(m<1||m>80) {printf("\n\n房间号输入有误,请您重新输入:"); scanf("%d",&m); } read(m); while(room[m-1].flag!=0) {printf("\n\n对不起,该房间已有客人入住,请输入其他房间号:"); scanf("%d",&m); read(m);} printf("\n\n该房间没有客人入住,您要入住该房间吗?〔1-是,2-否〕:"); scanf(

11、"%d",&j); while(j<1||j>2) {printf("\n\n您的选择输入有误,请您重新输入:"); scanf("%d",&j); } if(j==1) check_in(); else {printf("\n\n您需要继续查询吗?〔1-是,2-否〕:"); scanf("%d",&k); while(k<1||k>2) {printf("\n\n您的选择输入有误,请您重新输入:"); scanf("%d",&k); } if(k==1) goto chaxun; else {printf("\n\n"); main();} } }

12、 /*登记入住函数*/ void check_in() {system("cls"); /*清屏*/ system("color 4E"); int i; int j; int l; int k; int tab[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}}; printf("\n************************************登记入住****************

13、\n"); printf("请输入您将入住的房间号:"); scanf("%d",&i); while(i<1||i>80) {printf("\n\n房间号输入有误,请您重新输入:"); scanf("%d",&i); } read(i); while(room[i-1].flag!=0) /*判断房间是否入住*/ {printf("\n\n对不起,该房间已有客人入住,请输入其他房间号:"); scanf("%d",&i); read(i);} printf("\n\n

14、请输入您的XX:"); /*客人信息登记*/ scanf("%s",room[i-1].name); j=strlen(room[i-1].name); while(j<0) {printf("\n\n您的XX输入有误,请您重新输入:\n"); scanf("%s",room[i-1].name); j=strlen(room[i-1].name); } printf("\n\n请输入您的证件:"); scanf("%s",room[i-1].ID); j=strlen(room[i-1].ID); while(j!=18) {

15、printf("\n\n您的证件输入有误,请您重新输入:\n"); scanf("%s",room[i-1].ID); j=strlen(room[i-1].ID); } if(i<=40) {printf("\n\n您选择的是单人间,该房间148元/天,8元/小时。\n\n\n"); /*选择计费式*/ printf("请选择您的计费式〔1:按小时计费,2:按天计费〕:"); } else {printf("\n\n您选择的是双人间,该房间128元/天,7元/小时。\n\n\n"); printf("请选择您的计费式〔1:按

16、小时计费,2:按天计费〕:"); } scanf("%d",&room[i-1].flag); while(room[i-1].flag<0||room[i-1].flag>2) {printf("\n\n您的计费式输入有误,请您重新输入:"); scanf("%d",&room[i-1].flag); } printf("\n\n请按所示格式输入您的入住时间〔年-月-日-时,时为24小时制〕:"); scanf("%d-%d-%d-%d",&room[i-1].t[0].year,&room[i-1].t[0].mon,&room[i-1].t[0].date,&room[i

17、1].t[0].hour); l=judge_year(room[i-1].t[0].year); while((room[i-1].t[0].year<=0)||(room[i-1].t[0].mon<=0||room[i-1].t[0].mon>12)||(room[i-1].t[0].date<=0||room[i-1].t[0].date>tab[l][room[i-1].t[0].mon-1])||(room[i-1].t[0].hour<0||room[i-1].t[0].hour>=24)) {printf("\n\n您的入住时间输入有误,请按照格式重新输入:"); s

18、canf("%d-%d-%d-%d",&room[i-1].t[0].year,&room[i-1].t[0].mon,&room[i-1].t[0].date,&room[i-1].t[0].hour); l=judge_year(room[i-1].t[0].year); } printf("\n\n请输入您的押金数额:"); scanf("%ld",&room[i-1].deposit); while(room[i-1].deposit<=0) {printf("\n\n您的押金数额输入有误,请您重新输入:\n"); scanf("%ld",&room[i-1].depos

19、it); } printf("\n\n您是否确定您的信息:〔1-是,2-否〕:"); scanf("%d",&k); while(k<1||k>2) {printf("\n\n您的选择输入有误,请您重新输入:\n"); scanf("%d",&k); } if(k==1) {printf("\n\n您已登记入住成功,祝您在本店住得愉快!\n\n"); save(i); choice(); } else check_in(); } /*费用查询函数*/ void price() {system("cls");

20、/*清屏*/ system("color 4E"); printf("\n************************************费用查询************************************\n"); int i; int j; int k; int tab[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}}; int day=0; int hr=0; int total_hour; int total_day; l

21、ong int price; printf("请输入您的房间号:"); scanf("%d",&i); while(i<1||i>80) {printf("\n\n您的房间号输入有误,请您重新输入:"); scanf("%d",&i); } read(i); while(room[i-1].flag==0) /*判断房间是否已有客人入住*/ {printf("\n\n该房间无人入住,请重新输入您的房间号:"); scanf("%d",&i); read(i); } printf("\n\n请按所示格式输入当前时间〔年

22、月-日-时,时为24小时制〕:"); /*输入当前时间*/ shuru: scanf("%d-%d-%d-%d",&room[i-1].t[1].year,&room[i-1].t[1].mon,&room[i-1].t[1].date,&room[i-1].t[1].hour); j=judge_year(room[i-1].t[1].year); while((room[i-1].t[1].year<=0)||(room[i-1].t[1].mon<=0||room[i-1].t[1].mon>12)||(room[i-1].t[1].date<=0||r

23、oom[i-1].t[1].date>tab[j][room[i-1].t[1].mon-1])||(room[i-1].t[1].hour<0||room[i-1].t[1].hour>=24)) {printf("\n\n您的入住时间输入有误,请按照格式重新输入:"); scanf("%d-%d-%d-%d",&room[i-1].t[1].year,&room[i-1].t[1].mon,&room[i-1].t[1].date,&room[i-1].t[1].hour); j=judge_year(room[i-1].t[1].year); } if(room[i-1].t[

24、0].mon!=room[i-1].t[1].mon) {for(k=room[i-1].t[0].mon+1;k

25、lag==1) /*根据房间类型和计费式计算费用*/ {if(hr<0) {total_hour=day*24-hr;} else {total_hour=day*24+hr;} if(i<=40) price=8*total_hour; else price=7*total_hour; } if(room[i-1].flag==2) {while(hr<0) {day=day-1;hr=hr+24;} if(hr<8) {total_day=day;} else {total_day=day+1;} if(i<=

26、40) price=148*total_day; else price=128*total_day; } while(price<0) {printf("您的时间输入有误,请重新输入:"); goto shuru; } printf("\n\n当前费用为:%ld元.\n\n",price); /*输出当前费用*/ choice(); } /*结账退房函数*/ void fee() {system("cls"); system("color 4E"); printf("\n*****************************

27、结账退房************************************\n"); int i; int j; int k; int tab[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}}; int day=0; int hr=0; int total_hour; int total_day; long int price; long int fee; printf("请输入您的房间号:"); scanf("%d",&i)

28、 while(i<1||i>80) {printf("\n\n您的房间号输入有误,请您重新输入:"); scanf("%d",&i); } read(i); while(room[i-1].flag==0) /*判断房间是否有客人入住*/ {printf("\n\n该房间无人入住,请重新输入您的房间号:"); scanf("%d",&i); read(i); } printf("\n\n请按所示格式输入当前时间〔年-月-日-时,时为24小时制〕:"); /*输入当前时间*/ shur

29、u: scanf("%d-%d-%d-%d",&room[i-1].t[1].year,&room[i-1].t[1].mon,&room[i-1].t[1].date,&room[i-1].t[1].hour); j=judge_year(room[i-1].t[1].year); while((room[i-1].t[1].year<=0)||(room[i-1].t[1].mon<=0||room[i-1].t[1].mon>12)||(room[i-1].t[1].date<=0||room[i-1].t[1].date>tab[j][room[i-1].t[1].mon-1])

30、room[i-1].t[1].hour<0||room[i-1].t[1].hour>=24)) {printf("\n\n您的入住时间输入有误,请按照格式重新输入:"); scanf("%d-%d-%d-%d",&room[i-1].t[1].year,&room[i-1].t[1].mon,&room[i-1].t[1].date,&room[i-1].t[1].hour); j=judge_year(room[i-1].t[1].year); } if(room[i-1].t[0].mon!=room[i-1].t[1].mon) {for(k=room[i-1].t[

31、0].mon+1;k

32、 {if(hr<0) {total_hour=day*24-hr;} else {total_hour=day*24+hr;} if(i<=40) price=8*total_hour; else price=7*total_hour; } if(room[i-1].flag==2) {while(hr<0) {day=day-1;hr=hr+24;} if(hr<8) {total_day=day;} else {total_day=day+1;} if(i<=40) price=148*total_day; else price=128*total_

33、day; } while(price<0) {printf("您的时间输入有误,请重新输入:"); goto shuru; } fee=price-room[i-1].deposit; if(fee>0) /*输出最后的总费用*/ {printf("\n\n扣除押金后,您另需支付费用%ld元。",fee);} else if(fee==0) {printf("\n\n您所交纳的押金恰好能够支付您的住房费用,您无需另行交。");} else {printf("\n\n您所交纳的押金还

34、未使用完,本宾馆应支付您余额%ld元。",-fee);} printf("\n\n\n您已退房成功,感您的光临,我们下次再见!\n\n"); room[i-1].flag=0; strcpy(room[i-1].name,c1); strcpy(room[i-1].ID,c2); room[i-1].deposit=0; room[i-1].t[0].year=0; room[i-1].t[0].mon=0; room[i-1].t[0].date=0; room[i-1].t[0].hour=0; room[i-1].t[1].year=0; room[i-1].t[1

35、].mon=0; room[i-1].t[1].date=0; room[i-1].t[1].hour=0; save(i); choice(); } /*信息查询函数*/ void infor() {system("cls"); system("color 4E"); printf("\n************************************信息查询************************************\n"); int i; printf("请输入您的房间号:"); scanf("%d",&i); while(i<1||i

36、>80) {printf("\n\n您的房间号输入有误,请您重新输入:"); scanf("%d",&i); } read(i); while(room[i-1].flag==0) /*判断房间是否有客人入住*/ {printf("\n\n该房间无人入住,请重新输入您的房间号:"); scanf("%d",&i); read(i); } printf("\n\n您的信息如下:\n\n\n"); /*输出客人信息*/ printf("XX:"); puts(r

37、oom[i-1].name); printf("\n\n"); printf("证件:"); puts(room[i-1].ID); printf("\n\n"); printf("房间类型:"); if(i<=40) {printf("单人间\n\n\n");} else {printf("双人间\n\n\n");} printf("计费式:"); if(room[i-1].flag==1) {printf("按小时计费\n\n\n");} else {printf("按天计费\n\n\n");} printf("入住时间:"); printf("%d年%d%

38、月%d日%d时\n\n\n",room[i-1].t[0].year,room[i-1].t[0].mon,room[i-1].t[0].date,room[i-1].t[0].hour); printf("押金数额:"); printf("%ld元\n\n",room[i-1].deposit); choice(); } /*功能选择函数*/ void choice() {printf("\n************************************功能选择************************************\n"); printf("\

39、t\t\t [ 1. 入住情况 ]\n"); printf("\t\t\t [ 2. 登记入住 ]\n"); printf("\t\t\t [ 3. 当前费用 ]\n"); printf("\t\t\t [ 4. 结账退房 ]\n"); printf("\t\t\t [ 5. 信息查询 ]\n"); printf("\t\t\t [ 6. 回主界面 ]\n"); printf("\t\t\t [ 7. 全部信息 ]\n"); printf("

40、\t\t\t [ 8. 退出系统 ]\n"); int k; printf("请选择您需要的效劳:"); /*效劳选择*/ scanf("%d",&k); while(k<1||k>8) {printf("\n\n代码输入有误,请您重新输入:"); scanf("%d",&k); } switch(k) { case 1:chamber();break; /*调用房间情况函数*/ case 2:check_in();break; /*调用登记入住函数*/

41、case 3:price();break; /*调用当前费用函数*/ case 4:fee();break; /*调用结账退房函数*/ case 5:infor();break; /*调用信息查询函数*/ case 6:main();break; /*调用主函数*/ case 7:information();break; /*调用全部信息函数*/ case 8:exit(0); /*调用退出系统函数*/ } } /*判断

42、闰年函数*/ int judge_year(int x) {if((x%4==0)&&(x%100!=0)||(x%400==0)) return(1); else return(0); } /*全部信息查询*/ void information() {system("cls"); printf("\n************************************全部信息****************************

43、\n"); int i; int j; int k; int year; int month; int date; int hour; int year1; int month1; int day1; int hour1; int tab[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}}; int day=0; int hr=0; int total_hour; int total_day; long int price;

44、 printf("\n\n请按所示格式输入当前时间〔年-月-日-时,时为24小时制〕:"); /*输入当前时间*/ scanf("%d-%d-%d-%d",&year,&month,&date,&hour); j=judge_year(year); for(i=1;i<=80;i++) {read(i); if(room[i-1].flag==0) {printf("房间%d无人入住。\n",i); if(i<=40) {printf("房间类型:单人间。\n"); printf("单价:148元/天,8元/小时。\n");} else {pri

45、ntf("房间类型:双人间。\n"); printf("单价:128元/天,7元/小时。\n");} } else {year1=year-room[i-1].t[0].year; month1=month-room[i-1].t[0].mon; day1=date-room[i-1].t[0].date; hour1=hour-room[i-1].t[0].hour; while(hour1<0) {day1=day1-1;hour1=hour1+24;} printf("房间%d客户信息如下:\n",i); printf("XX:"); puts(room[i-1]

46、name); printf("证件:"); puts(room[i-1].ID); printf("房间类型:"); if(i<=40) {printf("单人间\n"); printf("单价:148元/天,8元/小时。\n"); } else {printf("双人间\n"); printf("单价:128元/天,7元/小时。\n"); } printf("计费式:"); if(room[i-1].flag==1) {printf("按小时计费\n");} else {printf("按天计费\n");} printf("入住时间:"); printf

47、"%d年%d%月%d日%d时\n",room[i-1].t[0].year,room[i-1].t[0].mon,room[i-1].t[0].date,room[i-1].t[0].hour); printf("已入住时间:%d年%d月%d天%d小时。\n",year1,month1,day1,hour1); printf("押金数额:"); printf("%ld元",room[i-1].deposit); if(room[i-1].t[0].mon!=month) {for(k=room[i-1].t[0].mon+1;k

48、1]; } day+=tab[j][room[i-1].t[0].mon-1]-room[i-1].t[0].date+date; } else {day+=date-room[i-1].t[0].date;} hr=hour-room[i-1].t[0].hour; if(room[i-1].flag==1) /*根据房间类型和计费式计算费用*/ {if(hr<0) {total_hour=day*24-hr;} else {total_hour=day*24+hr;} if(i<=40) price=8*total_

49、hour; else price=7*total_hour; } if(room[i-1].flag==2) {while(hr<0) {day=day-1;hr=hr+24;} if(hr<8) {total_day=day;} else {total_day=day+1;} if(i<=40) price=148*total_day; else price=128*total_day; } printf("\n当前费用为:%ld元.\n",price); /*输出当前费用*/ } day=0;hr=0;

50、 /*时间清零*/ } choice(); } /*保存信息函数*/ void save(int x) {int i; char c; FILE *fp; if((fp=fopen("酒店房间登记与计费管理系统信息存储文件.txt","wb+"))==NULL) {printf("无法翻开文件。\n\n\n"); printf("请按任意键返回主菜单,并选择“退出系统〞选项,在修改错误后再运行此系统。\n\n

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服