简易酒店管理系统代码
- 格式:doc
- 大小:123.00 KB
- 文档页数:26
#include
#include
#include
#include
//时间函数的定义
struct tm *localtime(const time_t * timep);
//时间的初始化
char *wday[]={"星期天","星期一","星期二","星期三","星期四","星期五","星期六"}; time_t timep;
struct tm *now;
struct tm *after;
// time(&timep);
//酒店房间的定义
struct house
{
char house_number[10];
char house_shape[2];
float house_price;
int sum_person;
// struct house *next;
}h[10]=
{
{"101","1",200.0,0},
{"102","1",200.0,0},
{"103","1",200.0,0},
{"104","2",150.0,0},
{"105","2",150.0,0},
{"106","3",100.0,0},
{"107","1",200.0,0},
{"108","2",150.0,0},
{"109","3",100.0,0},
{"110","1",200.0,0}
};
{
//住客姓名、性别、年龄、身份、身份证号码,房号,床号,入住日期、入住时间、离店日期、离店时间。
char name[10];
char sex[6];
int age;
char identify[18];
char identify_number[18];
char room[10];
char bed[10];
// Date guest_in;
// Date guest_out;
struct tm *p;
struct tm *q;
struct guest *next;
};
void first_inquiry()
{
int i=0;
int n=0;
char ch[2]="1";
for (i=0;i<10;i++)
{
if ((strcmp(h[i].house_shape,ch)==0))
{
if (h[i].sum_person==0)
{
printf("%s\t",h[i].house_number);
}
}
}
}
void second_inquiry()
{
{
int i=0;
int n=0;
char ch[2]="2";
for (i=0;i<10;i++)
{
if ((strcmp(h[i].house_shape,ch)==0))
{
if (h[i].sum_person==0)
{
printf("%s\t",h[i].house_number);
}
}
}
}
}
void third_inquiry()
{
int i=0;
int n=0;
char ch[2]="3";
for (i=0;i<10;i++)
{
if ((strcmp(h[i].house_shape,ch)==0))
{
if (h[i].sum_person==0)
{
printf("%s\t",h[i].house_number);
}
}
}
}
void lookfor_house_is_Null()
{
int your_choice;
do
{
printf("你要查询:1.单人间2.双人间3.多人间4.退出:\n");
printf("输入你的选择:\t");
scanf("%d",&your_choice);
switch(your_choice)
{
case 1:
printf("单人间的空余房间:\t");
first_inquiry();
printf("\n\n");
break;
case 2:
printf("双人房的空余房间:\t");
second_inquiry();
printf("\n\n");
break;
case 3:
printf("多人间的空余房间:\t");
third_inquiry();
printf("\n\n");
break;
case 4:
// exit(1);
break;
}
} while(your_choice!=4);
printf("\n");
printf("\n");
}
void add_house_sum_number(char str[10])
{
int i=0;
for (i=0;i<10;i++)
{
if ((strcmp(h[i].house_number,str)==0))
{