1.具有建立数据文件(客房信息文件、住客信息文件)功能; 2.具有数据输入功能; 3.具有数据修改功能; 4.具有数据删除功能; 5.能查询(查找)一些基本信息(如按房号查询、按姓名查询、空余客房查询等); 6.具有多种统计功能(要求有一定的实用性) (如某客房当前有那些空床、某住客应付多少费用、某天住店总人数和总收入等) 7.能具有排序功能(比如在查询所有的客房信息时,能根据房间价格进行排序,方便客人挑选房间
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
//#include <windows.h>
struct Room ;
struct Customer ;
typedef struct Room * Proom;
typedef struct Customer * Pcustomer;
struct Room
{
int RoomNumber;//房号
int RoomType;//房型
int Price;//单价(每床)
int Number; //已住人数
Proom next;
};
struct Customer
{
char name[10],ID[19]; //顾客姓名,顾客身份证号
char sex[5];//性别
int age;//年龄
int state;//房型
int room_number;//房号
int check_in_date;//入住日期
int departure_date ;//离店日期
Pcustomer next;
};
Proom head_room = NULL;
Pcustomer head_customer = NULL;
Proom r_room = NULL; //房间链表尾指针
Pcustomer r_customer = NULL;//顾客链表尾指针
Proom update_room_add(int room_num);
bool read_room() //读取room文件来创建链表
{
FILE *filep;
if((filep = fopen("d://Room.txt","a+")) == NULL)
{
printf("文件打开失败!");
getch();
return 0;
}
Proom temp_node = NULL;
temp_node = (Proom)malloc(sizeof(struct Room));
temp_node->next = NULL;
head_room = r_room = temp_node;
while(true)
{
if(feof(filep)||fread(temp_node,sizeof(struct Room),1,filep)!=1)
{
free(temp_node);
if (temp_node == head_room)
head_room = r_room = NULL;
else
r_room->next = NULL;
break;
}
r_room->next = temp_node;
r_room = r_room->next;
temp_node = (Proom)malloc(sizeof(struct Room));
temp_node->next = NULL;
}
return 1;
}
bool write_room() //保存room链表(即房间信息)到room文件
{
FILE *filep;
if((filep = fopen("d://Room.txt","w+")) == NULL)
{
printf("文件打开失败!");
getch();
return 0;
}
Proom temp_node = head_room;
while( temp_node != NULL )
{
fwrite(temp_node,sizeof(struct Room),1,filep);
temp_node = temp_node->next;
}
fclose(filep);
return 1;
}
bool read_customer()//读取customer文件来创建customer链表
{
FILE *fileq;
if((fileq = fopen("d://Customer.txt","a+")) == NULL)
{
printf("文件打开失败!");
getch();
return 0;
}
Pcustomer temp_node = (Pcustomer)malloc(sizeof(struct Customer));
head_customer = r_customer = temp_node;
while(true)
{
if(feof(fileq)||fread(temp_node,sizeof(struct Customer),1,fileq)!=1)
{
free(temp_node);
if (temp_node == head_customer)
head_customer = r_customer = NULL;
else
r_customer->next = NULL;
break;
}
r_customer->next = temp_node;
r_customer = r_customer->next;
temp_node = (Pcustomer)malloc(sizeof(struct Customer));
temp_node->next = NULL;
}
fclose(fileq);
return 1;
}
bool write_customer()//保存customer链表信息到customer文件
{
FILE *filep;
if((filep = fopen("d://Customer.txt","w+")) == NULL)
{
printf("文件打开失败!");
getch();
return 0;
}
Pcustomer temp_node = head_customer;
while( temp_node != NULL )
{
数据结构与算法课程设计说明报告书 ——简易客房管理系统_工学_高等教育_教育专区...在代码 实现上,住客登记录入的信息直接进入相应的链表并转存 Customer 文件中,...
学生成绩管理系统源代码 (数据结构与算法课设)C语言版_计算机软件及应用_IT/计算机_专业资料。 运行前 需在功程里新建个 ni.txt.内容如下 7 004 005 002 006...
数据结构课程设计 宾馆客房管理系统_计算机软件及应用...各功能模块源代码及详细介绍 (1) .主菜单 Init (...我想宾馆管理系统的算法和学生宿舍管理系统一样,所以...
数据结构课程设计报告(附源代码)-学生管理系统_工学...录入功能: 该功能实现良好,操作也较简单,程序运行时...的课设进行互相交换修改意见,学习别人的新算法或...
(桂电)学生成绩管理系统... 31页 2下载券 学生成绩管理系统源代码... 19页...简单学生成绩管理系统设... 52页 2下载券 数据结构与算法课程设计... 暂无评价...
《C++课程设计·酒店客房管理系统_理学_高等教育_教育...客房信息涉及的数据有 客房编号、客房类型、住房天数...图 7 所有客房的信息 4.关键代码分析(1)系统的...
数据结构课程设计各种排序算法比较 附带源代码_理学_...操作系统 windows 运行环境 vc6.0 算法设计的思想 ...用简单链表管理员工信息 20页 免费 排序算法集合 18...
数据结构课程设计报告图书馆管理系统(含源代码)_计算机软件及应用_IT/计算机_专业资料。数据结构课程设计报告图书馆管理系统今日推荐 78...
用C语言实现的宾馆客房管理系统课程设计报告_计算机软件...三、算法设计的思想 1.定义宾馆客房管理信息结构体 ...5.源程序可运行之后,将其数据、信息输入到文档中,...
大学C程序设计,课程设计客房管理系统源代码。...( ); //定义全局结构体变量,且里面又调用两个结...数据库客房管理系统 4页 免费 客房管理系统 22页 ...
热门文档