您好,欢迎来到华拓科技网。
搜索
您的当前位置:首页酒店管理系统源代码

酒店管理系统源代码

来源:华拓科技网


酒店管理系统源代码

#include

#include

#include

#include

typedef struct tagCustomer

{

char m_ID[19]; /*身份证号码*/

char m_name[10]; /*顾客姓名*/

int m_age; /*顾客年龄*/

char m_sex[6]; /*顾客性别*/

int num;

}Customer;/*顾客结构*/

1 / 19

typedef struct tagRoom

{

int m_num; /*房间号*/

int m_floor; /*楼层*/

int m_price; /*价格*/

int m_use; /*是否已入住*/

}Room;/*房间结构*/

int i,j=0,age,num,floor,price,use,n;

int reg =0;

Customer cus[5];

Room r[5];

int count=5;

char ID[18],name[10],sex[6];

2 / 19

FILE *fproom;

FILE *fpcustomer;

void Customer_Input()

{

if(count<=5)

{

printf(\"请输入身份证号(18位数字):\");

scanf(\"%s\j].m_ID);

printf(\"请输入姓名(10位字符)\");

scanf(\"%s\j].m_name);

printf(\"请输入年龄(数字型)\");

scanf(\"%d\j].m_age);

printf(\"请输入性别(男或女):\");

3 / 19

scanf(\"%s\j].m_sex);

}

else

{

printf(\"\\n 存储空间已满!\");

}

printf(\"\\n\\r顾客可以住在:\");

printf(\"\\n\\r房间号 楼层 价格 是否空闲(1:空闲0:已使用)\");

for(i=0;i{

if(r[i].m_use==1)

{

printf(\"\\n\\r%d %d %d 4 / 19

%d \

}

}

printf(\"\\n\\r请你输入房间号:\");

scanf(\"%d\

reg = 0;

for(i=0;i{

if(r[i].m_use==1&&r[i].m_num==num)

{

r[i].m_use = 0;

printf(\"\\n 登记成功!\\n\");

cus[j].num=r[i].m_num ;

j=j+1;

5 / 19

reg=1;

}

}

if(reg==0)

{

printf(\"\\n 登记失败!\\n\");

}

}

void Customer_ListOut()

{

if(count<=5)

{

printf(\"请输入身份证号(18位数字):\");

6 / 19

scanf(\"%s\

for(i=0;i{

if(strcmp(cus[i].m_ID,ID)==0)

{

printf(\"\\n\\r顾客身份证号:%s 姓名:%s \\n\

}

}

}

else

{

printf(\"\\n \\n\");

}

7 / 19

年龄:%d 性别:%s

}

void Room_ListOut()

{

printf(\"\\n\\r房间号 楼层 价格 是否空闲(1:空闲0:已使用)\");

for(i=0;i{

if(r[i].m_use==1)

{

printf(\"\\n\\r%d %d %d }

}

}

void PerCustomer_Search()

8 / 19

%d \

{

if(count<=5)

{

printf(\"请输入身份证号(18位数字):\");

scanf(\"%s\j].m_ID);

printf(\"请输入姓名(10位字符)\");

scanf(\"%s\j].m_name);

printf(\"请输入年龄(数字型)\");

scanf(\"%d\j].m_age);

printf(\"请输入性别(男或女):\");

scanf(\"%s\j].m_sex);

}

else

9 / 19

{

printf(\"\\n 住房已满!\");

}

printf(\"\\n\\r顾客可以预订:\");

printf(\"\\n\\r房间号 楼层 价格 是否空闲(1:空闲0:已使用)\");

for(i=0;i{

if(r[i].m_use==1)

{

printf(\"\\n\\r%d %d %d }

}

printf(\"\\n 请你输入要预订的房间号:\");

10 / 19

%d \

scanf(\"%d\

reg = 0;

for(i=0;i{

if(r[i].m_use==1&&r[i].m_num==num)

{

r[i].m_use = 0;

printf(\"\\n 预订成功!\\n\");

cus[j].num=r[i].m_num ;

j=j+1;

reg=1;

}

}

11 / 19

if(reg==0)

{

printf(\"\\n 预订失败!\\n\");

}

}

void UnCustomer_Out()

{

int k;

printf(\"\\n 请输入要退房顾客身份证:\");

scanf(\"%s\

for(i=0;i{

if(strcmp(cus[i].m_ID,ID)==0)

12 / 19

{

printf(\"\\n\\r顾客身份证号:%s 姓名:%s 年龄:%d 性别:%s \\n\\r已经成功退房!\

for(k=0;kif(r[k].m_num==cus[i].num)

r[k].m_use=1;

memset(&cus[i],0,sizeof(Customer));

}

}

}

void Customer_Goaway()

{

fproom=fopen(\"room\

fwrite((void *)&r,sizeof(Room),count,fproom);

13 / 19

fclose(fproom);

fpcustomer=fopen(\"customer\

fwrite((void *)&r,sizeof(Room),count,fpcustomer);

fclose(fpcustomer);

exit(0);

}

main()

{

fproom=fopen(\"room\if(fproom!=NULL)

{

for(i=0;i{

/ 19

14

int id=100;

r[i].m_num=i+100;

r[i].m_floor=1;

r[i].m_price=100;

r[i].m_use=1;

}

fwrite((void *)&r,sizeof(Room),count,fproom);

fclose(fproom);

}

else

{

printf(\"\\n---文件打开失败--\");

}

15 / 19

for(;;)

{

printf(\"\\n\");

printf(\"/******************************************\\\\\\n\");

printf(\"* *\\n\");

printf(\"* 酒店管理系统 *\\n\");

printf(\"* 主菜单 *\\n\");

printf(\"* *\\n\");

printf(\"* 1.顾客登记 *\\n\");

printf(\"* 2.查询顾客信息 *\\n\");

printf(\"* 3.查询空房间 *\\n\");

printf(\"* 4.预订房间 *\\n\");

printf(\"* 5.退订房间 *\\n\");

16 / 19

printf(\"* 6.保存并退出系统 *\\n\");

printf(\"* *\\n\");

printf(\"\\\\******************************************/\\n\\n\");

printf(\"请输入选择项(1-6):\");

scanf(\"%d\

printf(\"\\n\\n\\n\\n\");

if(n>0&&n<=6)

{

switch(n)

{

case 1:Customer_Input();break;

case 2:Customer_ListOut();break;/*查询顾客信息*/

case 3:Room_ListOut();break;/*查询空房间*/

17 / 19

case 4:PerCustomer_Search();break;/*预订房间*/

case 5:UnCustomer_Out();break;/*退订房间*/

case 6:Customer_Goaway(); /*保存退出*/

}

}

else

{

printf(\"***********************************************************************\\n\");

printf(\"* *\\n\");

printf(\"* 输入错误! *\\n\");

printf(\"* 请退出! *\\n\");

18 / 19

printf(\"* *\\n\");

printf(\"***********************************************************************\\n\");

break;

}

}

}

19 / 19

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo6.cn 版权所有 赣ICP备2024042791号-9

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务