-
room[i-1].t[0].date,&room[i-1].t[0].hour); l=judge_year(room[i-1].t[0].year); }
printf(\请输入您的押金数额:\ scanf(\ while(room[i-1].deposit<=0)
{printf(\您的押金数额输入有误,请您重新输入:\\n\ scanf(\ }
printf(\您是否确定您的信息:(1-是,2-否):\ scanf(\ while(k<1||k>2)
{printf(\您的选择输入有误,请您重新输入:\\n\ scanf(\ } if(k==1)
{printf(\您已登记入住成功,祝您在本店住得愉快!\\n\\n\ save(i); choice();
可编辑
-
} else check_in(); }
/*费用查询函数*/ void price()
{system(\ /*清屏*/ system(\
printf(\费
用
************************************\\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;
printf(\请输入您的房间号:\ scanf(\ while(i<1||i>80)
{printf(\您的房间号输入有误,请您重新输入:\ scanf(\ } read(i);
while(room[i-1].flag==0) /*判断房间是否已有客人入住*/
{printf(\该房间无人入住,请重新输入您的房间号:\ scanf(\ read(i); }
printf(\请按所示格式输入当前时间(年-月-日-时,时为24小时制):\ /*输入当前时间*/ shuru:
scanf(\
可编辑
-
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])||(room[i-1].t[1].hour<0||room[i-1].t[1].hour>=24))
{printf(\您的入住时间输入有误,请按照格式重新输入:\ scanf(\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[0].mon+1;k day+=tab[j][room[i-1].t[0].mon-1]-room[i-1].t[0].date+room[i-1].t[1].date; } else 可编辑 - {day+=room[i-1].t[1].date-room[i-1].t[0].date;} hr=room[i-1].t[1].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_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 可编辑
C语言课程设计---酒店房间登记与计费管理系统源代码
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)