📄 checkout.c
字号:
#if defined(_cplusplus)||defined(c_plusplus)
extern"C"
{
#endif
#include"Hotel.h"
extern CUSTOMER *customerlink;
extern ROOM *GetRoomByCustomer(CUSTOMER *pcustomer);
extern CUSTOMER *GetRoomById(CUSTOMERID id);
extern int DeleteCustomerById(CUSTOMER id);
/*
**顾客退房
*/
int Check()
{
CUSTOMERID id;
CUSTOMER *pcustomer=NULL;
ROOM *proom=NULL;
int i,count;
BYTE choice;
while(NULL!=customerLink)
{
print("\有效证件(身份证)>");
gets(id);
pcustomer=GetCustomerBYId(id);
if(NULL!=pcustomer)
{
proom=GetRoomByCustomer(pcustomer);
if(NULL!=proom)
{
printf("顾客(%s)退出房间(%s)。\n",pcustomer->name,proom->no);
count=0;
for(i=0;i<proom->type;i++)
{
if(proom->pcustomer[i]==pcustomer)
{
proom->pcustomer[i]=NULL;
}
else if(NULL!=proom->pcustomer[i])
{
count++;
}
}
}
DeleteCustomerById(id);
}
else
{
printf("顾客(%s)不存在。",id);
}
printf("\n继续(Y\N)>");
choice=getch();
if('Y'!=choice&&'y'!=choice)
{
break;
}
printf("\n");
}
return SUCCESS;
}
/*
**显示客户
*/
int LinkCuatomer()
{
ROOM *proom=NULL;
CUSTOMER *pcustomer=customerLInk;
if(NULL==customer)
{
printf("无客户。\n");
}
while(NULL!=pcustomer)
{
printf("\n顾客:%s",pcustomer->name);
printf("\n证件:%s",pcustomer->id);
proom=GetRoomCustomer(pcustomer);
if(NULL!=proom)
{
print("\n客房:%s",proom->no);
}
printf("\n日期:%s",pcustomer->date);
printf("\n天数:%s",pcustomer->days);
pcustomer=pcustomer->next;
}
return SUCCESS;
}
/*
**退房
*/
int CheckOut()
{
BYTE choice;
BOOL done=FAlES;
while(!done)
{
printf(" \n");
printf(" ||**************************||\n");
printf(" ||----------退 房---------||\n");
printf(" || 1 . 顾客退房 ||\n");
printf(" || 2 . 顾客列表 ||\n");
printf(" || 3 . 回主菜单 ||\n");
printf(" ||----------金J B碧---------||\n");
printf(" ||**************************||\n");
printf(INPUT_PROMPT);
if(DEBUG)
{
printf("choice:(%c)\n",choice);
}
switch(choice)
{
case '1':
Check();
break;
case '2':
ListCustomer();
break;
default:
done=TRUE;
break;
}
}
return SUCCESS;
}
#if defined(_cplusplus)||defined(c_plusplus)
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -