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

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

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

e_year, e_month, e_day, 1);
}

else if ( s_year == e_year ) //同一年的时间判断
{
day1 = count_day ( s_year, s_month, s_day, 1 );
day2 = count_day ( e_year, e_month, e_day, 1 );
day = day2-day1;
}
else
day = 1;
return day;
}
//计算天数的核心
int count_day ( int year, int month, int day, int flag )
{
static int day_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 p, i, s;
if (leap(year)) //闰年为1选择后面的用
p = 1;
else
p = 0;
if (flag)
{
s = day;
for ( i = 1; i < month; i++ )
s += day_tab[p][i-1];
}
else
{
s = day_tab[p][month] - day;
for ( i = month + 1; i <= 12; i++ )
s += day_tab[p][i-1];
}
return ( s );
}
//平闰年的判断
int leap(int year)
{
if ( year%4 == 0&&year%100!=0||year % 400 ==0)
return 1;
else
return 0;
}

void sum_customer_price( Pcustomer customer)//顾客应付总价格
{
int num_price;
Proom p = check_room_number(customer->room_number );
if (NULL != p)
{
num_price = sum_data (customer) * ( p->Price );
printf( "房客应付款%d元\n",num_price );
}
}

int total_customer_numer(Proom room)//顾客总人数
{
Proom p;
p = head_room;
int num = 0;
while ( p != NULL )
{
num=num+p->Number;
p=p->next;
}
return num;
}

int total_price_day( Proom head_room)//当天总收入
{
Proom p;
p = head_room;
int num_price = 0;
while ( p != NULL )
{
if ( p->RoomType == 3 )
{
num_price=num_price +(p->Price) * (p->Number);
p=p->next;
}
else
{
num_price=num_price +p->Price;
p=p->next;
}
}
return num_price;
}

//按单价给客房排序(插入排序)
void sort_insert(Proom room)
{
Proom pre,now,p,q;
pre = head_room->next;
if ( pre == NULL ) return;
now = pre->next;
if ( now == NULL ) return;
while ( now != NULL )
{
q = head_room;
p = head_room->next;
while (p != now && p->Price <= now->Price )
{
q = p;
p = p->next;
}
if( p == now )
{
pre = pre->next;
now = pre->next;
continue;
}

pre->next = now->next;
q->next = now;
now->next = p;
now = pre->next;
}
}

//按房号给住客信息排序(冒泡排序)
void sort_bubble()
{
Pcustomer p, q, pre;
pre = head_customer;
p = head_customer->next;
if ( p = NULL ) return;
q = p->next;
if ( q = NULL ) return;
int noswap;
int num_customer = total_customer_numer(head_room);
for ( int i = 0; i < num_customer-1; i++ )
{
noswap = 1;
for ( int j = 0; j < num_customer-i-1; j++ )
//while ( q != NULL )
if ( p->room_number > q->room_number )
{
pre->next = q;
p->next = q->next;
q->next = p;
q = p->next;
noswap = 0;
}
if ( noswap ) break;
}
}

void update_room_type(int num)// 修改房

上一页第4页

你可能喜欢

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

热门文档

相关文档

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