酒店管理系统源代码#includestring.h#includestdlib.h#includestdio.h#includeconio.htypedefstructtagCustomer{charm_ID[19];/*身份证号码*/charm_name[10];/*顾客姓名*/intm_age;/*顾客年龄*/charm_sex[6];/*顾客性别*/intnum;}Customer;/*顾客结构*/typedefstructtagRoom{intm_num;/*房间号*/intm_floor;/*楼层*/intm_price;/*价格*/intm_use;/*是否已入住*/}Room;/*房间结构*/inti,j=0,age,num,floor,price,use,n;intreg=0;Customercus[5];Roomr[5];intcount=5;charID[18],name[10],sex[6];FILE*fproom;FILE*fpcustomer;voidCustomer_Input(){if(count=5){printf(请输入身份证号(18位数字):);scanf(%s,&cus[j].m_ID);printf(请输入姓名(10位字符));scanf(%s,&cus[j].m_name);printf(请输入年龄(数字型));scanf(%d,&cus[j].m_age);printf(请输入性别(男或女):);scanf(%s,&cus[j].m_sex);}else{printf(\n存储空间已满!);}printf(\n\r顾客可以住在:);printf(\n\r房间号楼层价格是否空闲(1:空闲0:已使用));for(i=0;icount;i++){if(r[i].m_use==1){printf(\n\r%d%d%d%d,r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}printf(\n\r请你输入房间号:);scanf(%d,&num);reg=0;for(i=0;icount;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;}}if(reg==0){printf(\n登记失败!\n);}}voidCustomer_ListOut(){if(count=5){printf(请输入身份证号(18位数字):);scanf(%s,&ID);for(i=0;icount;i++){if(strcmp(cus[i].m_ID,ID)==0){printf(\n\r顾客身份证号:%s姓名:%s年龄:%d性别:%s\n,cus[i].m_ID,cus[i].m_name,cus[i].m_age,cus[i].m_sex);}}}else{printf(\n\n);}}voidRoom_ListOut(){printf(\n\r房间号楼层价格是否空闲(1:空闲0:已使用));for(i=0;icount;i++){if(r[i].m_use==1){printf(\n\r%d%d%d%d,r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}}voidPerCustomer_Search(){if(count=5){printf(请输入身份证号(18位数字):);scanf(%s,&cus[j].m_ID);printf(请输入姓名(10位字符));scanf(%s,&cus[j].m_name);printf(请输入年龄(数字型));scanf(%d,&cus[j].m_age);printf(请输入性别(男或女):);scanf(%s,&cus[j].m_sex);}else{printf(\n住房已满!);}printf(\n\r顾客可以预订:);printf(\n\r房间号楼层价格是否空闲(1:空闲0:已使用));for(i=0;icount;i++){if(r[i].m_use==1){printf(\n\r%d%d%d%d,r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}printf(\n请你输入要预订的房间号:);scanf(%d,&num);reg=0;for(i=0;icount;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;}}if(reg==0){printf(\n预订失败!\n);}}voidUnCustomer_Out(){intk;printf(\n请输入要退房顾客身份证:);scanf(%s,&ID);for(i=0;icount;i++){if(strcmp(cus[i].m_ID,ID)==0){printf(\n\r顾客身份证号:%s姓名:%s年龄:%d性别:%s\n\r已经成功退房!,cus[i].m_ID,cus[i].m_name,cus[i].m_age,cus[i].m_sex);for(k=0;kcount;k++)if(r[k].m_num==cus[i].num)r[k].m_use=1;memset(&cus[i],0,sizeof(Customer));}}}voidCustomer_Goaway(){fproom=fopen(room,wb+);fwrite((void*)&r,sizeof(Room),count,fproom);fclose(fproom);fpcustomer=fopen(customer,wb+);fwrite((void*)&r,sizeof(Room),count,fpcustomer);fclose(fpcustomer);exit(0);}main(){fproom=fopen(room,wb);if(fproom!=NULL){for(i=0;icount;i++){intid=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---文件打开失败--);}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);printf(*6.保存并退出系统*\n);printf(**\n);printf(\\******************************************/\n\n);printf(请输入选择项(1-6):);scanf(%d,&n);printf(\n\n\n\n);if(n0&&n=6){switch(n){case1:Customer_Input();break;case2:Customer_ListOut();break;/*查询顾客信息*/case3:Room_ListOut();break;/*查询空房间*/case4:PerCustomer_Search();break;/*预订房间*/case5:UnCustomer_Out();break;/*退订房间*/case6:Customer_Goaway();/*保存退出*/}}else{printf(***********************************************************************\n);printf(**\n);printf(*输入错误!*\n);printf(*请退出!*\n);printf(**\n);printf(***********************************************************************\n);break;}}}