#include<>#include<>structpeopledata{ charname[11]; charsex[3]; intage;intidcard[2];};structdate{ intyear; intmonth; intday; inttime;//住宿时间。};typedefstruct{ intnumber; charkind; structpeopledatapeople; structdatetime;}rooms;voidadddata(){ FILE*fp; roomsroom; chartag,select; inti; do{printf("房间编号:"); scanf("%d",&); fflush(stdin); printf("房间类型:"); scanf("%c",&); printf("住宿人员信息:\n");printf("\t\t姓名:"); fflush(stdin); scanf("%s",); fflush(stdin); printf("\t\t性别:"); gets(); printf("\t\t年龄:"); scanf("%d",&); printf("\t\t请输入身份证号码:"); for(i=0;i<2;i++) scanf("%d",&[i]); printf("入住时间:\n"); printf("\t\t年:"); scanf("%d",&); printf("\t\t月:"); scanf("%d",&); printf("\t\t日:"); scanf("%d",&); printf("入住时长:"); scanf("%d",&); fflush(stdin); if((fp=fopen("d:\\","a"))==NULL) { printf("打开文件”酒店住宿登记表“失败,按任意键退出。\n"); exit(0); } else { printf("确定要写入资料吗?(y/n)\n");scanf("%c",&select); fflush(stdin); if(select=='y') { fwrite(&room,sizeof(rooms),1,fp); if(ferror(fp)!=0) { printf("写入资料失败,按任意键退出。\n"); exit(0); } printf("要继续添加?(y/n)\n"); scanf("%c",&tag);fflush(stdin); } else { printf("要继续添加吗?(y/n)\n"); scanf("%c",&tag); fflush(stdin); } } fclose(fp); } while(tag=='y');}voidupdata(){ FILE*fp; roomsroom; intnumber,i; printf("请输入要更新的信息的房间编号:\n"); sc
酒店管理系统C语言版 来自淘豆网www.taodocs.com转载请标明出处.