【正文】
t[j].date=a。a)。scanf(%s,b)。scanf(%d,amp。 case 11:modify()。scanf(%d,amp。b)。load_room()。jr。amp。modify_s(m,n)。scanf(%d,amp。 case 2:menu()。 return NULL。jp。}(2)加載函數(shù) load_room()[說明]:該函數(shù)可以用來加載所有記錄,并且可以返回所有記錄的個數(shù)。if((fp=fopen(,r))==NULL) {printf(\nCannot open file\n)。i++) for(j=0。room[i].price,amp。room[i].client_list[j].year,amp。 r=i。printf(\n\n\tSuccessful^^.\n\n)。if(w==1)browse()。do{puts(\nmodify by=\n\n 1).number 2).name 3).cancel and back)。if(c3||c1){puts(\nChoice error!please again!)。break。case 3:menu()。printf(\nAre you sure?\n\n\t1).sure 2).no and remodify 3).back without save in this time [ ]\b\b)。}while(w1==2)。雖然最后的一個模塊是通過網(wǎng)絡(luò)找到的,但是也通過此個模塊學到了一些在課堂上沒有真正掌握的文件部分的自如運用。得到了好多以后可以避免錯誤的經(jīng)驗。通過實習,我們還明白了一些做人的道理。C不是最好,我們試著將它做的更好。想象重要,動手更重要。鏈表、文件的定位、以及真正的vc操作技術(shù)。在實習中遇到了好多的調(diào)試不出結(jié)果的問題。}五.上機操作編譯出一個程序,需要上機運行檢驗程序是否正確,此外在上機過程中你可以思考一下該程序還有沒有其他的實現(xiàn)方案或者那些事可以更好的改進的。w1)。}puts(\nNow:\n)。scanf(%s,staff[i].name)。}}while(c3||c1)。scanf(%d,amp。}(4)修改整條數(shù)據(jù)記錄函數(shù)modify_data(int i,int n)void printf_face()。scanf(%d,amp。}(3)一個任務結(jié)束時的選擇瀏覽還是返回的函數(shù)printf_back()void printf_back(){int k,w。room[i].client_list[j].date)。room[i].client_list[j].sex,amp。j++) fscanf(fp,%d,%s,%d,%d,%s,%d,%d,%s,%d,%d,%d,amp。 } for(i=0。struct hotel room[N]。fclose(fp)。ir。int i,j。switch(l) {case 1:modify_day()。puts(What you want to do?\n)。if(w==1) printf_p(m,n)。amp。ip。scanf(%d,amp。puts(\nMonth:)。puts(\t\tPlease input the date)。room[i].price=a。break。break。 case 8:printf(Please input the new room_ID\n)。scanf(%d,amp。a)。room[i].client_list[j].year=a。break。break。 case 3:printf(Please input the new age\n)。scanf(%d,amp。scanf(%s,s)。printf(Please choice your number(110):[ ]\b\b)。 }}void modify_s(int i,int j) /*********修改執(zhí)行項*********/{int a,q。l)。 save()。j++) if(strcmp(room[i].client_list[j].name,s)==0) w=1,m=i,n=j。for(i=0。char s[20]。 case 2:modify_day()。 }else m=0。if(n1amp。puts(\t\t**************************************************\n)。do{puts(\t\t*********************MENU************************\n)。break。puts(1).search again\t2).back\n)。amp。jr。load_room()。b)。 scanf(%d,amp。case 2:search()。scanf(%d,amp。if(w==1)printf_p(m,n)。ir。printf(Please input the name\n)。break。}while(m==1)。amp。printf(\t\tPlease choice your number(13):[ ]\b\b)。puts(\t\t1).Search someone had erev lived here\n)。printf(\nTel:%s\n,room[i].tel)。printf(\nyear:%d\n,room[i].client_list[j].year)。printf(\nsex:%d\n,room[i].client_list[j].sex)。break。puts(1).Statistics again\t2).back\n)。jp。 case 2:stat()。scanf(%d,amp。j++) if(room[i].client_list[j].month==n) s=s+1。for(i=0。puts(Please input the month you want to statistics:)。break。}while(m==1)。amp。printf(\t\tPlease choice your number(13):[ ]\b\b)。puts(\t\t\t\t1).Statistics one month\n)。 menu()。room[i].client_list[j].date)。scanf(%d,amp。 puts(\n\tYear:\t)。sc