300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > c语言旅馆信息管理系统 C语言旅馆信息管理系统.doc

c语言旅馆信息管理系统 C语言旅馆信息管理系统.doc

时间:2023-03-31 14:05:44

相关推荐

c语言旅馆信息管理系统 C语言旅馆信息管理系统.doc

实用文案

标准文档

/*

*

*题目:旅店信息管理系统

*

*小组成员:闫若琳 戴雨晨 马渊沐 张子飞 李闯

王浩 崔以博 孙浩浩 李春普 温健成

*/

#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();break;

case '8':exit(0);break;

default :printf ("Error !");break ;

}

printf ("\n\n请按任意键继续 !\n");

getch();

system("cls");

}while(1);

return 0 ;

}

void out_information()//张子飞:定义out_inf

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。