C语言旅馆管理系统_第1页
C语言旅馆管理系统_第2页
C语言旅馆管理系统_第3页
C语言旅馆管理系统_第4页
C语言旅馆管理系统_第5页
已阅读5页,还剩27页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

治理房间和客户住宿信息,包括扫瞄、查询、添加、修改和删除功能。房间信息治理:房间包括房间号和房间标准,房间的添加必需指明房价标注,房间号不能重复客户住宿信息治理:记当天,房间号应是系统中存在的且可以入住。注销客户:即结算退房的操作。注销时间为当天,应付金额为住房天数二.【需求分析】输出等操作;在程序中需要扫瞄客户的信息,应供给显示,查找,修改等操作;三【总体设计】用用C语言实现系统;系统的各个功能模块要求用函数实现;界面友好〔良好的人机交互〕,程序加必要的注释。模块.录逐条复制到构造体数组中。查询记录模块。查询记录模块主要完成在构造体数组中查找满足相关条件的客户记录。在此旅馆成绩治理系统中,用户可以依据客户的姓名或身份证在NULL并打印出未找到该客户记录的提示信息。需要将修改的数据存入源数据文件。后会自动删除客户的记录。输出记录模块。输出记录模块主要完成两个任务。第一,它实现对客户记录的存盘操作,马上构造体中的存储的客户记录信息写入数据文件中。其次,可以将这个系统的设计分为以下模块:系统功能模块图系统功能模块图退旅馆治理系统旅馆治理系统MainMenu订房房间总BookRoom息扫瞄Room体房间信息查客户住宿修改结账退RoomSerstomsotel询房退出四【具体设计】主函数中各功能模块用菜单方式选择,菜单局部写成函数。[流程图]开头开头N密码验证Ymenu_select退出显示一系列功能选项依据字符的值调用各函数模块[程序]主函数开头******/main{FILE*fp;clrscr;/*清屏*/file_new_or_old;/*推断是否需要建文件*/menu_select; /*主菜单函数*/}}块后能够返回到系统界面。/*主菜单函数*/intmenu_select{inti,a;chars[128];do{clrscr;printf(“ MainMenudesignedbyChenZhihua\n“);printf(“**************************************\n“);printf(“|1:BookRoom|\n“);/*订房*/printf(“|2:RoomScan|\n“);/*房间总体信息扫瞄*/printf(“|3:RoomSearch|\n“);/*房间信息查询*/printf(“|4:CostomRevise|\n“);/*客户住宿修改函数*/printf(“|5:Outhotel|\n“);/*结账退房*/printf(“|6:Quit|\n\n“);/*退出*/printf(“\nInputyourchoice(1~6):“);/*提示输入选项*/scanf(“%s“,s);/*输入选择项*/i=atoi(s);/*将输入的字符串转化为整型数*/if(i<1||i>6){a=1;printf(“\nWrongnumber!!!\n\nPrintanykeytocontinue...\n“);getch;}elsea=0;}while(a==1);switch(i){case1:book_room;break;/*订房*/case2:room_scan;break;/*房间总体信息扫瞄*/case3:room_search;break;/*房间信息查询*/case4:costom_revise;break;/*客户住宿修改函数*/case5:outhotel;break;/*前台结账退房*/case6:exit(0);/*如返回值为,则程序完毕*/}}}显示一系列的功能选项显示一系列的功能选项n,推断nNY调用book_room调用room_scan调用调用outhotel数 数room_search函数调用costom_revise退出函函数函函数各功能模块设计[分析]中一个渠道。故我也设计了一个密码验证的模块。【流程图】开头开头设定用户名及密码定义用户名和密码,应当是字码推断对错[程序]/*密码验证函数*/#defineID“11“ /*设定用户名*/#definePW“22“ 设定密码*/intpassword{charid[20],pw[20];/*定义用户输入的用户名和密码,应当是字符串*/intx=1;/*输入次数*/printf(“*******************************************\n“);printf(“*********AHotelManagermentSystem********\n“);printf(“*******************************************\n“);while(x<=3)/*利用循环屡次输入*/{printf(“Ifyouwantusetheprogram,pleaseinputyourID:);/*提示*/gets(id);/*用户输入用户名*/printf(“Pleaseinputyourpassword:/*提示*/gets(pw);/*用户输入密码*/计数*/if(x>3){printf(“Youjustinputtedmanytimeswrongpassword,soyoucan”tusetheprogram\n“);break;}/*假设输入三次循环停顿*/if(strcmp(id,ID)==0&&strcmp(pw,PW)==0)/*字符串的比较不能用==,要用strcmp函数*/{return1;}/*假设用户名和密码相匹配,那么循环停顿*/elseprintf(“Ifyouforgetthepassword,tocontacttheadmin,please!\n“);}}getch;return0;}[分析]号码作为构造体成员。同时运用了构造体的嵌套。struct Customer/*客户信息构造*/{charname[20]; 姓名*/charsex[N]; 性别*/intage; /*年龄*/charstatusID[20]; 证*/charphone[20]; /**/intyear;intmonth;intdate;};structRoom/*客房构造体*/{introom_ID;inttel;intprice;intsign;structCustomerCustomer_list;}room[N];【流程图】开头开头依次登记客户各信息YN推断客房是否占用重输入调用主菜单函数[程序]voidbook_room{FILE*fp;charc;inti,t=0;inte;clrscr;do{if((fp=fopen(“file.txt“,“r“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)fread(&room[i],sizeof(structRoom),1,fp);printf(“Whichroomareyougoingtobook:(1-%d)Room[]\b\b“,N);scanf(“%d“,&e);if(e>=1&&e<=N){e--;if(room[e].sign==0){printf(“Pleaseinputyourname:“);printf(“Pleaseinputyoursex(mstandsforMan,wstandsforWoman):“);scanf(“%s“,&room[e].Customer_list.sex);printf(“Pleaseinputyourage:“);scanf(“%d“,&room[e].Customer_list.age);printf(“PleaseinputyourstatusID:“);scanf(“%s“,&room[e].Customer_list.statusID);printf(“Pleaseinputyourphone:“);scanf(“%s“,&room[e].Customer_list.phone);printf(“Pleaseinputyourdate(yearmonthdate):“);printf(“Thisisthedatayoujustinput:\n“);printf(“%s\t%s\t%d\t%s\t%s“,room[e].Customer_,room[e].Customer_list.sex,room[e].Customer_list.age,room[e].Customer_list.statusID,room[e].Customer_list.phone);printf(“\t%d.%d.%d“,room[e].Customer_list.year,room[e].Customer_list.month,room[e].Customer_list.date);printf(“\n\tSave?(y/n):“);c=getchar;c=getchar;if(c==”y”){room[e].sign=1;left--;if((fp=fopen(“file.txt“,“w“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)fwrite(&room[i],sizeof(structRoom),1,fp);printf(“\nSuccessful!\n“);roomnumber:%d\n\ttel:%d\n\tprice:%d“,room[e].room_ID,room[e].tel,room[e].price);fclose(fp);}}elseprintf(“\nSorry!Thisroomhasbeentaken!!!\n\n“);}elseprintf(“\nWrongnumber!!!\n“);printf(“\n\n\tAgain?(y/n):“);getchar;c=getchar;if(c==”y”)t=1;elset=0;}while(t==1);printf(“Printanykeytocontinue...\n“);getch;menu_select;}}(3)查询记录模块[需求分析]该功能的模块是显示全部客户及房间记录的信息。开头各房间及客户信息开头各房间及客户信息调用主菜单函数[程序]/*房间总体信息扫瞄*/voidroom_scan{FILE*fp;inti,j;clrscr;if((fp=fopen(“file.txt“,“r“))==NULL){printf(“\nCannotopenthefile!\n“);exit(0);}for(i=0;i<N;i++){fread(&room[i],sizeof(structRoom),1,fp);printf(“Room%d:\n\tname:%s\n\tsex:%s (mstandforMan,wstandforWoman)\n\tage:%d\n\tstatusID:%s\n\tphone:%s“,i+1,room[i].Customer_,room[i].Customer_list.sex,room[i].Customer_list.age,room[i].Customer_list.statusID,room[i].Customer_list.phone);printf(“\n\ttime:%d.%d.%d\n“,room[i].Customer_list.year,room[i].Customer_list.month,room[i].Customer_list.date);elseprintf(“\t\t\tUntaken!\n“);if(i%2==1){printf(“\n\nPrintanykeytonext!\n“);getch;}}printf(“\nEnd!!!\n\n“);printf(“Thereare%droomswith%dempty.\n“,N,left);fclose(fp);printf(“Printanykeytocontinue...\n“);getch;menu_select;}/*房间信息查询*/voidroom_search{intn,i,a;FILE*fp;charc;printf(“Whichroomareyougoingtosearch?(1-%d):Room[]\b\b“,N);do{

if(n<1||n>N){a=1;printf(“\nWrongnumber!!!\nPleaseinputagain:(1-%d),Room[]\b\b“,N);}elsea=0;}while(a==1);{printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++){fread(&room[i],sizeof(structRoom),1,fp);}printf(“Room %d:\n\tname:%s\n\tsex:%s (m stand for Man,w stand Woman)\n\tage:%d\n\tstatusID:%s\n\tphone:%s\n\ttime:%d.%d.%d\n“,n,room[n-1].Customer_,room[n-1].Customer_list.sex,room[n-1].Customer_list.age,room[n-1].Customer_list.statusID,room[n-1].Customer_list.phone,room[n-1].Customer_list.year,room[n-1].Customer_list.month,room[n-1].Customer_list.date);printf(“Thisroom”stelephonenumber:%d\n\t\t\tprice:%d\n\t“,room[n-1].tel,room[n-1].price);if(room[n-1].sign)printf(“\nHasbeentaken!!!\n\n“);else{printf(“\n\tEmpty!\tAreyougoingtobookit?(y/n)[]\b\b“);c=getchar;c=getchar;printf(“\n“);if(c==”y”)book_room;}fclose(fp);printf(“Printanykeytocontinue...\n“);getch;menu_select;}(4)(4)修改模块相应信息。需要修改哪项【流程图】需要修改哪项输入要修改的房间号Y输入要修改的房间号Y是否找到此客户N显示找到的记录修改提示没有找到询问客户是否连续修改返回主菜单[程序]/*客户住宿修改函数*/voidcostom_revise{inti,n,t,a;charc;FILE*fp;structRoomroom[N];clrscr;printf(“Whichroomareyougoingtorevise:(1-%d)Room[]\b\b“,N);scanf(“%d“,&n);n--;if((fp=fopen(“file.txt“,“r“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++){fread(&room[i],sizeof(structRoom),1,fp);}do{clrscr;printf(“ Whichpartareyougoingtorevise \n“);printf(“| 1:Name |\n“);printf(“| 2:Sex |\n“);printf(“|3:Age|\n“);printf(“|4:StatusID|\n“);printf(“|5:Phone|\n“);printf(“|6:Date|\n“);printf(“|7:Tel|\n“);printf(“|8:Price|\n“);printf(“|9.Giveup|\n“);do{printf(“\nInputyourchoice(1~9):“);scanf(“%d“,&t);if(t<1||t>9){a=1;printf(“\nWrongnumber!!!\nPleaseinputagain:(1-%d),Room[]\b\b“,N);}elsea=0;switch(t){case1:printf(“\nTheformernameis\“%s\“.Pleaseinputnewname:“,room[n].Customer_);scanf(“%s“,room[n].Customer_);break;case2:printf(“\nTheformersexis\“%d\“.Pleaseinputnewsex:“,room[n].Customer_list.sex);scanf(“%s“,&room[n].Customer_list.sex);break;case3:printf(“\nTheformerageis\“%d\“.Pleaseinputnewage:“,room[n].Customer_list.age);scanf(“%s“,&room[n].Customer_list.age);break;case4:printf(“\nTheformerstatusIDis\“%s\“.PleaseinputnewstatusID:“,room[n].Customer_list.statusID);scanf(“%s“,room[n].Customer_list.statusID);break;case5:printf(“\nTheformerphoneis\“%s\“.Pleaseinputnewphone:“,room[n].Customer_list.phone);scanf(“%s“,room[n].Customer_list.phone);break;case 6:printf(“\nThe former time is \“%d.%d.%d\“.Please input new date:(year date)“,room[n].Customer_list.year,room[n].Customer_list.month,room[n].Customer_list.date);case7:printf(“\nTheformertelis\“%d\“.Pleaseinputnewtel:“,room[i].tel);scanf(“%d“,&room[n].tel);case8:printf(“\nTheformerpriceis\“%d\“.Pleaseinputnewprice:“,room[i].price);scanf(“%d“,&room[i].price);case9:menu_select;}fclose(fp);{printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)fwrite(&room[i],sizeof(structRoom),1,fp);printf(“\n\tSuccessfull!!!\n“);printf(“\nReviseother?(y/n)[]\b\b“);getchar;c=getchar;fclose(fp);printf(“\nPrintanykeytocontinue...\n“);getch;menu_select;}(5)(5)退房模块[分析]态。[流程图]开头Y开头Y是否成功NY输出错误信息从文件中读入数据Y客房是否都为空N输入房间号n输出全部房间都为空NNY被占用NY输出房间信息N确定离开Y输入当前日期输出所需付租金将数据置为原始值,left++调用主菜单函数【程序】结账退房函数*/voidouthotel{FILE*fp;charc;intt=0,p,i,n,year,month,date;{printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++){fread(&room[i],sizeof(structRoom),1,fp);if(room[i].sign)t=1;}if(t==1){do{p=0;printf(“Pleaseinputyourroomnumber:(1-%d)Room[]\b\b“,N);scanf(“%d“,&n);if(n<0||n>N){p=1,printf(“\nWrongnumber!!!\n“);}elseif(room[n-1].sign==0)printf(“\n\nThisroomhasnotbeentaken!!!\n\nPleaseinputagain!\n“);}while(p==1||room[n-1].sign==0);printf(“Thisisyourinformation:\n“);printf(“name:%s\nsex:%s\nage:%d\nstatusID:%s\nphone:%s\n“,room[n-1].Customer_,room[n-1].Customer_list.sex,room[n-1].Customer_list.age,room[n-1].Customer_list.statusID,room[n-1].Customer_list.phone);printf(“entertime:%d.%d.%d\n“,room[n-1].Customer_list.year,room[n-1].Customer_list.month,room[n-1].Customer_list.date);printf(“\n\nAreyousuretoleave?(y/n):“);getchar;c=getchar;if(c==”y”){printf(“\nInputthetimenow:“);printf(“You

shoudpay:%d“,room[n-1].price*((year-room[n-1].Customer_list.year)*365+(month-room[n-1].Customer_list.month)*30+date-room[n-1].Customer_list.date));left++;room[n-1].sign=0;“);room[n-1].Customer_list.age=0;strcpy(room[n-1].Customer_list.sex,““);“);strcpy(room[n-1].Customer_list.phone,““);room[n-1].Customer_list.year=0;room[n-1].Customer_list.month=0;room[n-1].Customer_list.date=0;fclose(fp);{printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)Room),1,fp);fclose(fp);printf(“\n\n\tSuccessfull!!!\n“);}}elseprintf(“\nSorry!Alltheroomisempty.\n“);printf(“\n\nPrintanykeytocontimue...\n“);getch;menu_select;}}写错了。作都不能进展,后经调试觉察改正,程序正常运行。网查找资料,套用了别人的构造体嵌套,解决了主要问题。六.【上机操作】密码验证模块提示密码错误,需要重输入推断是否建文件模块主菜单模块订房模块依次输入客户信息,推断是否保存及是否连续订房房间总体信息扫瞄模块房间信息查询模块客户住宿修改模块结账退房模块C】存在很多的问题,我还有很多的东西要学,还有很多的方面有待提高。到了悲喜变迁。了内用。于是就冲破第一道难关。义了格外简洁的函数,都会在后面加上注释,自己感觉思路格外清楚、明白。要求更高。的,就这样,请教师检查指导。八.【总程序】#include“stdio.h“ /*I/O函数*/#include“stdlib.h“/*标准库函数*/#include“string.h“ /*字符串函数*/#include“ctype.h“ 字符操作函数*/#defineID“11“ /*设定用户名*/#definePW“22“ /*设定密码*/#defineM80 */#defineN10intleft=N;struct Customer/*客户信息构造*/{charname[20]; 姓名*/charsex[N]; 性别*/intage; /*年龄*/charstatusID[20]; 证*/charphone[20]; /**/intyear;intmonth;intdate;};structRoom/*客房构造体*/{introom_ID;inttel;intprice;intsign;structCustomerCustomer_list;}room[N];/******以下是函数原型******/intpassword; /*密码验证函数*/voidfile_new_or_old; 是否需要建文件*/intmenu_select; /*主菜单函数*/voidbook_room; /*订房*/voidroom_scan; /*房间总体信息扫瞄*/voidroom_search; /*房间信息查询*/voidcostom_revise; /*客户住宿修改函数*/voidouthotel; /*结账退房函数*/主函数开头******/main{FILE*fp;clrscr;/*清屏*/file_new_or_old;/*推断是否需要建文件*/menu_select; /*主菜单函数*/}密码验证函数*/intpassword{charid[20],pw[20];/*定义用户输入的用户名和密码,应当是字符串*/intx=1;/*输入次数*/printf(“*******************************************\n“);printf(“*********AHotelManagermentSystem********\n“);printf(“*******************************************\n“);while(x<=3)/*利用循环屡次输入*/{printf(“Ifyouwantusetheprogram,pleaseinputyourID:);/*提示*/gets(id);/*用户输入用户名*/printf(“Pleaseinputyourpassword:/*提示*/gets(pw);/*用户输入密码*/计数*/if(x>3){printf(“Youjustinputtedmanytimeswrongpassword,soyoucan”tusetheprogram\n“);break;}/*假设输入三次循环停顿*/if(strcmp(id,ID)==0&&strcmp(pw,PW)==0)/*字符串的比较不能用==,要用strcmp函数*/{return1;}/*假设用户名和密码相匹配,那么循环停顿*/elseprintf(“Ifyouforgetthepassword,tocontacttheadmin,please!\n“);}getch;return0;}/*推断是否需要建文件*/voidfile_new_or_old{inti;charc;FILE*fp;printf(“*******************************************\n“);printf(“thesystermofhotelmanagement!\n“);printf(“*******************************************\n“);printf(“| Areyougoingtonewthefile: |\n“);printf(“| y:Yes |\n“);printf(“| n:No |\n\n“);printf(“*******************************************\n“);printf(“\nInputyourchoice(y/n):“);/*提示输入选项*/scanf(“%c“,&c);if(c==”y”){for(i=0;i<N;i++){room[i].room_ID=i+1;room[i].tel=800+i;room[i].price=80;room[i].sign=0;}if((fp=fopen(“file.txt“,“w“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)fwrite(&room[i],sizeof(structRoom),1,fp);fclose(fp);}else{if((fp=fopen(“file.txt“,“r“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)fread(&room[i],sizeof(structRoom),1,fp);for(i=0;i<N;i++)fclose(fp);}}/*主菜单函数*/intmenu_select{inti,a;chars[128];do{clrscr;printf(“ MainMenudesignedbyChenZhihua\n“);printf(“|1:BookRoom|\n“);/*订房*/printf(“|2:RoomScan|\n“);/*房间总体信息扫瞄*/printf(“|3:RoomSearch|\n“);/*房间信息查询*/printf(“|4:CostomRevise|\n“);/*客户住宿修改函数*/printf(“|5:Outhotel|\n“);/*结账退房*/printf(“|6:Quit|\n\n“);/*退出*/printf(“\nInputyourchoice(1~6):“);/*提示输入选项*/scanf(“%s“,s);/*输入选择项*/i=atoi(s);/*将输入的字符串转化为整型数*/if(i<1||i>6){a=1;printf(“\nWrongnumber!!!\n\nPrintanykeytocontinue...\n“);getch;}elsea=0;}while(a==1);switch(i){case1:book_room;break;/*订房*/case2:room_scan;break;/*房间总体信息扫瞄*/case3:room_search;break;/*房间信息查询*/case4:costom_revise;break;/*客户住宿修改函数*/case5:outhotel;break;/*前台结账退房*/case6:exit(0);/*如返回值为,则程序完毕*/}}/*订房函数*/voidbook_room{FILE*fp;charc;inti,t=0;inte;clrscr;do{if((fp=fopen(“file.txt“,“r“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)fread(&room[i],sizeof(structRoom),1,fp);printf(“Whichroomareyougoingtobook:(1-%d)Room[]\b\b“,N);scanf(“%d“,&e);if(e>=1&&e<=N){e--;if(room[e].sign==0){printf(“Pleaseinputyourname:“);printf(“Pleaseinputyoursex(mstandsforMan,wstandsforWoman):“);scanf(“%s“,&room[e].Customer_list.sex);printf(“Pleaseinputyourage:“);scanf(“%d“,&room[e].Customer_list.age);printf(“PleaseinputyourstatusID:“);scanf(“%s“,&room[e].Customer_list.statusID);printf(“Pleaseinputyourphone:“);scanf(“%s“,&room[e].Customer_list.phone);printf(“Pleaseinputyourdate(yearmonthdate):“);printf(“Thisisthedatayoujustinput:\n“);printf(“%s\t%s\t%d\t%s\t%s“,room[e].Customer_,room[e].Customer_list.sex,room[e].Customer_list.age,room[e].Customer_list.statusID,room[e].Customer_list.phone);printf(“\t%d.%d.%d“,room[e].Customer_list.year,room[e].Customer_list.month,room[e].Customer_list.date);printf(“\n\tSave?(y/n):“);c=getchar;c=getchar;if(c==”y”){room[e].sign=1;left--;if((fp=fopen(“file.txt“,“w“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++)fwrite(&room[i],sizeof(structRoom),1,fp);printf(“\nSuccessful!\n“);roomnumber:%d\n\ttel:%d\n\tprice:%d“,room[e].room_ID,room[e].tel,room[e].price);fclose(fp);}}elseprintf(“\nSorry!Thisroomhasbeentaken!!!\n\n“);}elseprintf(“\nWrongnumber!!!\n“);printf(“\n\n\tAgain?(y/n):“);getchar;c=getchar;if(c==”y”)t=1;elset=0;}while(t==1);printf(“Printanykeytocontinue...\n“);getch;menu_select;}/*房间总体信息扫瞄*/voidroom_scan{FILE*fp;inti,j;clrscr;if((fp=fopen(“file.txt“,“r“))==NULL){printf(“\nCannotopenthefile!\n“);exit(0);}for(i=0;i<N;i++){fread(&room[i],sizeof(structRoom),1,fp);printf(“Room%d:\n\tname:%s\n\tsex:%s (mstandforMan,wstandforWoman)\n\tage:%d\n\tstatusID:%s\n\tphone:%s“,i+1,room[i].Customer_,room[i].Customer_list.sex,room[i].Customer_list.age,room[i].Customer_list.statusID,room[i].Customer_list.phone);printf(“\n\ttime:%d.%d.%d\n“,room[i].Customer_list.year,room[i].Customer_list.month,room[i].Customer_list.date);elseprintf(“\t\t\tUntaken!\n“);if(i%2==1){printf(“\n\nPrintanykeytonext!\n“);getch;}}printf(“\nEnd!!!\n\n“);printf(“Thereare%droomswith%dempty.\n“,N,left);fclose(fp);printf(“Printanykeytocontinue...\n“);getch;menu_select;}/*房间信息查询*/voidroom_search{intn,i,a;FILE*fp;charc;printf(“Whichroomareyougoingtosearch?(1-%d):Room[]\b\b“,N);do{if(n<1||n>N){a=1;printf(“\nWrongnumber!!!\nPleaseinputagain:(1-%d),Room[]\b\b“,N);}elsea=0;}while(a==1);{printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++){fread(&room[i],sizeof(structRoom),1,fp);}printf(“Room %d:\n\tname:%s\n\tsex:%s (m stand for Man,w stand Woman)\n\tage:%d\n\tstatusID:%s\n\tphone:%s\n\ttime:%d.%d.%d\n“,n,room[n-1].Customer_,room[n-1].Customer_list.sex,room[n-1].Customer_list.age,room[n-1].Customer_list.statusID,room[n-1].Customer_list.phone,room[n-1].Customer_list.year,room[n-1].Customer_list.month,room[n-1].Customer_list.date);printf(“Thisroom”stelephonenumber:%d\n\t\t\tprice:%d\n\t“,room[n-1].tel,room[n-1].price);if(room[n-1].sign)printf(“\nHasbeentaken!!!\n\n“);else{printf(“\n\tEmpty!\tAreyougoingtobookit?(y/n)[]\b\b“);c=getchar;c=getchar;printf(“\n“);if(c==”y”)book_room;}fclose(fp);printf(“Printanykeytocontinue...\n“);getch;menu_select;}/*客户住宿修改函数*/voidcostom_revise{inti,n,t,a;charc;FILE*fp;structRoomroom[N];clrscr;printf(“Whichroomareyougoingtorevise:(1-%d)Room[]\b\b“,N);n--;if((fp=fopen(“file.txt“,“r“))==NULL){printf(“\nCannotopenthefile!!!\n“);exit(0);}for(i=0;i<N;i++){fread(&room[i],sizeof(structRoom),1,fp);}do{clrscr;printf(“ Whichpartareyougoingtorevise \n“);printf(“|1:Name|\n“);printf(“|2:Sex|\n“);printf(“|3:Age|\n“);printf(“|4:StatusID|\n“);printf(“|5:Phone|\n“);printf(“|6:Date|\n“);printf(“|7:Tel|\n“);printf(“|8:Price|\n“);printf(“|9.Giveup|\n“);do{printf(“\nInputyourchoice(1~9):“);scanf(“%d“,&t);if(t<1||t>9){a=1;printf(“\nWrongnumber!!!\nPleaseinputagain:(1-%d),Room[]\b\b“,N);}elsea=0;switch(t){case1:printf(“\nTheformernameis\“%s\“.Pleaseinputnewname:“,room[n].Customer_);scanf(“%s“,room[n].Customer_);break;case2:printf(“\nTheformersexis\“%d\“.Pleaseinputnewsex:“,room[n].Customer_list.sex);scanf(“%s“,&room[n].Customer_list.sex);break;case3:printf(“\nTheformerageis\“%d\“.Pleaseinputnewage:“,room[n].Customer_list.age);scanf(“%s“,&room[n].Customer_list.age);break;case4:printf(“\nTheformerstatusIDis\“%s\“.PleaseinputnewstatusID:“,room[n].Customer_list.statusID);scanf(“%s“,room[n].Customer_list.statusID);break;case5:printf(“\nTheformerphoneis\“%s\“.Pleaseinputnewphone:“,room[n].Customer_list.phone);scanf(“%s“,room[n].Customer_list.phone);break;case 6:printf(“\nThe former time is \“%d.%d.%d\“.Please input new date:(year date)“,room[n].Customer_list.year,room[n].Customer_list.month,room[n].Customer_list.date);case7:pri

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论