*题目:旅店信息管理系统
*小组成员:
#include
#include
#include
#include
#define MIN 1
#define MAX 30
#define LEN sizeof(struct Hotel) //用LEN代替结
构体的"长度"
void regeist();
void out_information();
void search_number();
void show_all();
void search_name();
void change();
void fire();
struct Hotel *load();
FILE *fp;
struct Hotel
{
int room_number;
char name [20];
char sex[10];
char ID [20];
float paid[10];
int inyear ;
int inmonth ;
int inday ;
struct Hotel *next ;
};
struct Hotel *load() //定义load函数读取当前的信息,并存
到内存链表中
{
struct Hotel *head,*pb, *s ;
pb (struct Hotel *)malloc(LEN); //开辟新的节点
s (struct Hotel *)malloc(LEN);
if((pb NULL)||(s NULL))
{
printf ("动态内存分配失败!\n");
getch();
exit(0);
}
if((fp fopen("resturant.txt","rb")) NULL)
{
printf ("无法打开文件!\n");
getch();
exit(0);
}
head pb;
while (fread (s,LEN,1,fp)) //读取当前的信息,并存到链
表中
{
pb->next s;
pb s;
s (struct Hotel *)malloc(LEN);
}
pb->next NULL;
return head ; //返回链表的头指针
}
int main () //崔以博、孙浩浩
{ char choice ;
do {printf ("\n\n欢迎使用旅店信
息管理系统\n\n");
printf ("1.查看旅店信息\n2.查看某一房间信息\n3.查看
旅客信息\n");
printf ("4.查找某一旅客信息\n5.旅客入住\n6.旅客换房
\n7.旅客退房\n8.退出\n");
printf
("\n
\n");
choice getch();
switch (choice)
{
case '1':out_information();break;
case '2':search_number();break;
case '3':show_all();break;
case '4':search_name();break;
case '5':regeist();break;
case '6':change();break;
case '7':fire();brea