文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > 数据结构与算法课设源代码——简易客房管理系统
侵权投诉

数据结构与算法课设源代码——简易客房管理系统

1.具有建立数据文件(客房信息文件、住客信息文件)功能; 2.具有数据输入功能; 3.具有数据修改功能; 4.具有数据删除功能; 5.能查询(查找)一些基本信息(如按房号查询、按姓名查询、空余客房查询等); 6.具有多种统计功能(要求有一定的实用性) (如某客房当前有那些空床、某住客应付多少费用、某天住店总人数和总收入等) 7.能具有排序功能(比如在查询所有的客房信息时,能根据房间价格进行排序,方便客人挑选房间

->state,customer->ID,
customer->room_number,customer->check_in_date,customer->departure_date);
}

void printf_all_customer()//打印全部顾客信息
{
printf( "姓名 性别 年龄 房型 身份证号 房号 入住日期 离开日期\n");
Pcustomer customer = head_customer;
while ( customer != NULL )
{
printf_customer(customer);
customer = customer->next;
}
}

int check_empty_room() //查询空房
{
Proom p = head_room;
int num_empty_room = 0;
printf( "房号 房型 价格 已住人数 \n");
while ( p != NULL )
{
if ( p->Number == 0 )
{
printf_room(p);
num_empty_room++;
}
p = p->next;
}
return num_empty_room;
}

int sum_empty_room()//空房间总数
{
printf("共有空房间%d\n",check_empty_room());
return 0;
}


Proom update_room_less(int room_num) //更新房间信息(离店人数减少)
{
Proom p = check_room_number(room_num);
p->Number = p->Number - 1;
return 0;
}

Proom update_room_add(int room_num) //更新房间信息(进店人数增加)
{
Proom p = check_room_number(room_num);
p->Number = p->Number + 1;
return 0;
}

int delete_customer(char name[10])//退房
{
Pcustomer p,q;
q = p = head_customer;
if (p == NULL)
{
return 0;
}
if (strcmp(p->name,name) == 0)
{
int room_num = p->room_number;
update_room_less(room_num);
if (r_customer == head_customer)
{
printf("退房成功!\n");
head_customer = r_customer = NULL;
return 1;
}
head_customer = head_customer->next;
free(p);
printf("退房成功!\n");
return 1;
}
p = p->next;
while (p != NULL&& 0 != strcmp(p->name,name))
{
p = p->next;
q = q->next;
}
if(p == NULL)
{
printf("此人不在此店!\n");
return 0;
}
else
{
int room_num = p->room_number;
update_room_less(room_num);
if (p == r_customer)
{
r_customer = q;
}
q->next = p->next;
free(p);
printf("退房成功!\n");
return 1;
}
}

Pcustomer update_customer(char name[10])//住客换房
{
delete_customer(name);
insert_post_link_customer();
return NULL;
}

int count_day( int, int, int, int ); //计算两个日期中间的天数
int leap( int );//平闰年计算
int sum_data( Pcustomer customer ) //计算顾客所住天数
{
int year, day, day1, day2;
int s_year, s_month, s_day, e_year, e_month, e_day;//s为起始的日期,e为终止日期

e_day = customer->departure_date%100;
e_month = customer->departure_date/100%100;
e_year = customer->departure_date/10000;

s_day = customer->check_in_date%100;
s_month = customer->check_in_date/100%100;
s_year = customer->check_in_date/10000;

if ( s_year < e_year ) //不同年的时间判断
{
day = count_day ( s_year, s_month, s_day , 0 );
for (year=s_year+1;year<e_year; year++ )//年份累加

if (leap(year))//闰年
day += 366;
else //平年
day += 365;

day += count_day (

上一页第3页

你可能喜欢

  • 数据结构学生信息管理系统
  • C语言图书管理系统课程设计
  • c学生成绩管理系统课程设计
  • 信息系统管理办法
  • 02382管理信息系统
  • 数据结构停车场管理
  • 学生管理系统详细设计
  • C++银行管理系统

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email