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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值