You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
p5p3fiabm/查询房间入住情况.c

34 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

void availability() //查询房间入住情况函数
{
int g,count=0;
for(g=0;g<100;g++)
{
if(z[g]==0)
++count;
else
if(z[g]==1)
printf("\n正在使用的房间号:%d",g);
}
printf("\n\n未使用的房间数:%d",count); //通过循环输出未使用的房间数
printf("\n\n");
printf("\n请输入需查询的房间号: "); //查询输入的房间号的信息,且输出该房间的相关信息
scanf("%d",&s);
while(s<0||s>100)
{printf(" *********************您输入的数字有误,请重新输入。********************\n");
scanf("%d",&s);}if(s==0) menu();
if(z[s]==1)
{printf("姓名:%s",room[s].name);
printf("\n性别(其中1表示男2表示女):%d",room[s].sex);
printf("\n年龄:%d",room[s].age);
printf("\n身份证号:%s",room[s].ID_card);
printf("\n年:%d",room[s].date.year);
printf(" 月:%d",room[s].date.month);
printf(" 日:%d",room[s].date.day);
printf("\n房间号:%d",room[s].room_ID);
}
else
printf("该房间未被使用!");
menu();
save(); //调用保存函数
}