版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
課程設(shè)計(jì)目的:CC語言的一個(gè)重要環(huán)節(jié),為提高學(xué)生的程序設(shè)建筑課程設(shè)計(jì)目的:CC語言的一個(gè)重要環(huán)節(jié),為提高學(xué)生的程序設(shè)建筑工地信息管理系統(tǒng)建筑工地(工地號(hào),名字,城市)(配件號(hào),配件名,顏色,重量,產(chǎn)地(號(hào)碼,名字,狀態(tài),城市塊塊塊塊單N輸入n,判斷主函塊塊塊塊單N輸入n,判斷主函數(shù)流程根據(jù)n值調(diào)用各voidmenu(){intvoidmenu(){intputs("\tt************建筑工地信息管理***********\nn");puts("姓名:宋伯石");puts("學(xué)號(hào):20101002811");puts("班學(xué)號(hào):051103-18puts("\tt****************MENU*******************nn");puts("\tttt1輸入");puts("\tttt2刪除");puts("\tt\t\t3.查找");puts("\tt\t\t4.配對(duì)");puts("\tttt5Exit");puts("\n\n\t\t**************************************\n");loop:printf("Chooseyournumber(1-5):[]\b\b");scanf("%d",&if(n<1||n>5){printf("Error!");goto{switch({case1:enter();break;case2:delete();break;case3:search();break;case4:search2();break;case5:exit(0);}}loop;}}main(){menu();}二、各功能模塊設(shè)YYNN數(shù)據(jù)輸入模voidsal_enter(){jcharc[YYNN數(shù)據(jù)輸入模voidsal_enter(){jcharc[2FILE*if((fp=fopen("data1.dat","wb"))==NULL){printf("Cannotopenthefile!\n");exit(0}for(j=0;j<i;j++)fread(&sal[j],sizeof(structsale),1,fp);while(1){printf("輸入銷售商號(hào)碼n");scanf("%d",&sal[inum1);printf("輸入配件號(hào)碼n");scanfprintf("輸入銷售商號(hào)碼n");scanf("%d",&sal[inum1);printf("輸入配件號(hào)碼n");scanf("%d",&salinum2printf("輸入工地號(hào)碼n");scanf("%d",&salinum3printf("輸入數(shù)量r:\n");scanf("%d",&sal[i].num4if(fwrite(&sal[i++],sizeof(structsale),1,fp)!=1)printf("Filewriteerror\n");elseprintf("Successful!\loopprintf("是否繼續(xù)?(是y否n])\n");scanf("%s"c);if(strcmp(c,"n")==0){break;if(strcmp(c,"y")!=0{printf("error!\n");gotoloop;}}}fclose(fp);menu();}voidbuild_enter(){intj;charc[2];FILE*if((fp=fopen("data2.dat","wb"))==NULL){printf("Cannotopenthefile!\n");exit(0);}for(j=0;j<i;j++)fwrite(&build[j],sizeof(structbuilding),1,while(1{printf("輸入項(xiàng)目號(hào)碼:\n");scanf("%d",&build{printf("輸入項(xiàng)目號(hào)碼:\n");scanf("%d",&buildinum1printf("輸入工地號(hào):\n");scanf("%d",&build[inum);printf("輸入工地名:\n");scanf("%s",build[iname);printf("輸入工地城市:\n");scanf("%s",build[i].city);if(fwrite(&build[i++],sizeof(structbuilding),1,fp)!=1)printf("Filewriteerror\n");elseprintf("Successful!\loopprintf("是否繼續(xù)?(是y否n])\n");scanf("%s",c);if(strcmp(c,"n")==0)break;{if(strcmp(c,"y")!=0{printf("error!\n");goto}}fclose(fp);menu();loop;}}voidpj_enter(){intj;charc[2];FILE*if((fp=fopen("data3.dat","wb"))==NULL){printf("Cannotopenthefile!\n");exit(0);}for(j=0;j<i;j++)fwrite(&pj[j],sizeof(structpeijian),1,while(1{printf("輸入配件號(hào)scanf("%d",&pjinum);printf("輸入配件名n");scanf("%scanf("%d",&pjinum);printf("輸入配件名n");scanf("%s",pj[iname);printf("輸入配件顏色n");scanf("%s",pj[icolor);printf("輸入配件重量n");scanf("%d",&pjiweight);printf("輸入配件產(chǎn)地n");scanf("%s",pj[iarea);if(fwrite(&pj[i++],sizeof(structpeijian),1,fp)!=1)printf("Filewriteerror\n");elseprintf("Successful!\loop:printf("Isthereanymore?(Yes[y]/No[n])scanf("%s",c);if(strcmp(c,"n")==0)break;\{if(strcmp(c,"y")!=0{printf("error!\n");gotoloop;}}}fclose(menu();}voidSET_enter{intj;charc[2];FILE*if((fp=fopen("data4.dat","wb"))==NULL){printf("Cannotopenthefile!\n");exit(0);}for(j=0;j<i;j++)fwrite(&sel[j],sizeof(structseller),1,while(1{printf("輸入銷售商號(hào)n");scanf("%d",&sel[inum);printf("輸入銷售商名n");printf("輸入銷售商號(hào)n");scanf("%d",&sel[inum);printf("輸入銷售商名n");scanf("%s",sel[i].name);printf("輸入銷售商狀態(tài)n");scanf("%s",sel[i].state);printf("輸入銷售商所在城市scanf("%s",sel[i].city);if(fwrite(&sel[i++],sizeof(structseller),1,fp)!=1)printf("Filewriteerror\n");elseprintf("Successful!\loop:printf("Isthereanymore?(Yes[y]/No[n])scanf("%s",c);if(strcmp(c,"n")==0)break;{if(strcmp(c,"y")!=0{printf("error!\n");gotoloop;}}\}fclose(menu();}voidenter(){intt,{puts("\t\t***************MENU*************\n\n");puts("\t\t\t\t1.sal_enterputs("\t\t\t\t2.build_enterputs("\t\t\t\t3.pj_enterputs("\t\t\t\t4.SET_enterputs("\t\t\t\t5.Exit");data");data");data");data");puts("\n\n\t\t********************************\printf("Choosethenumber(1-5):[]\b\scanf("%d",&if(m<1||m>5{t=1;getchar();elset=0}while(t==1);switch(m){caseelset=0}while(t==1);switch(m){case1:sal_enter();break;case2:build_enter();break;casecasecase}:pj_enter();break;:SET_enter();break;5:menu();}(2)模NYN刪除模塊流void{intj,v=0;intx;void{intj,v=0;intx;intFILE{printf("Cannotopenthefile!\n");}loop:printf("請(qǐng)輸入要?jiǎng)h除的銷售商號(hào)碼(輸入0if(x==0){if(fread(&sal[j],sizeof(structsale),1,fp)!=1)break;}{}{printf("Cannotfindthedata!\n\n");gotoloop;}{ }printf("\nprintf("%d,\t\t%d,%d,printf("刪除成功}void{intj,v=0,x;intFILE{printf("Cannotopenvoid{intj,v=0,x;intFILE{printf("Cannotopenthefile!\n");}loop:printf("請(qǐng)輸入要?jiǎng)h除的工地號(hào)(輸入0返回menu):");if(x==0){if(fread(&build[j],sizeof(structbuilding),1,fp)!=1)break;}{{printf("Cannotfindthedata!\n\n");gotoloop;}{{if(j!=w)fwrite(&build[j],sizeof(struct}printf("\n項(xiàng)目號(hào),工地號(hào),工地名,城市名%d,printf("刪除成功}void{intj,v=0,x;intFILE{printf("Cannotopenthevoid{intj,v=0,x;intFILE{printf("Cannotopenthefile!\n");}loop:printf("請(qǐng)輸入要?jiǎng)h除的配件號(hào)(輸入0返回menu):");if(x==0){if(fread(&pj[j],sizeof(structpeijian),1,fp)!=1)break;}{ {printf("Cannotfindthedata!\n\n");gotoloop;}{ }printf("\n配件號(hào),配件名,顏色,重量,產(chǎn)地printf("刪除成功}voidSET_delete{intj,v=0;intx;intFILEvoidSET_delete{intj,v=0;intx;intFILE{printf("Cannotopenthefile!\n");}loop:printf("請(qǐng)輸入號(hào)碼(輸入0返回menu):");if(x==0){if(fread(&sel[j],sizeof(structseller),1,fp)!=1)break;}{ {printf("Cannotfindthedata!\n\n");gotoloop;}{ }printf("\n銷售商號(hào)碼,銷售商名字,狀態(tài),城市:\printf("刪除成功}void{int{puts("\t\t\t1.sal_deletevoid{int{puts("\t\t\t1.sal_deletenewdata");puts("\t\t\t2.build_deletenewdata");puts("\t\t\t3.pj_deletenewdata");/*********刪除菜單****************/puts("\t\t\t4.SET_deletenewdata");puts("\n\n\t\t********************************\n");printf("Choosethenumber(1-5):[]\b\b");{t=1;getchar();else}{case1:sal_delete();break;case2:build_delete();break;case3:pj_delete();break;case4:SET_delete();break;case5:menu();}}(3)模文件是否存YNYN圖 查找模塊流程文件是否存YNYN圖 查找模塊流程void{inti,w=101,j,x,h=0;FILEprintf("1--printf("2--printf("3--printf("4--項(xiàng)目號(hào)工地號(hào)配件號(hào) if(x==5)elseif(x<1||x>5){printf("Error!\n");gotoelse{{printf("Cannotopenthe}printf("Pleaseinputtheprintf("Cannotopenthe}printf("Pleaseinputthe配件號(hào):");if(i==pj[j].num)if(w==101)printf("Cannotfindthedata!\n");{printf("配件號(hào)printf("配件名printf("配件顏色printf("配件重量printf("配件產(chǎn)地}}else{{printf("Cannotopenthefile!\n");}printf("請(qǐng)輸入銷售商號(hào){if(fread(&sel[j],sizeof(structseller),1,fp)!=1)if(i==sel[j].num)if(w==101)printf("Cannotfindthedata!\n");{printf("銷售商if(i==sel[j].num)if(w==101)printf("Cannotfindthedata!\n");{printf("銷售商號(hào)printf("銷售商名printf("所在城市名}}else{{printf("Cannotopenthefile!\n");}if(i==build[j].num){w=j;break;}if(w==101)printf("Cannotfindthedata!\n");{printf("所在城市名}}else{{printf("Cannotopenthefile!\n");}else{{printf("Cannotopenthefile!\n");}printf("請(qǐng)輸入項(xiàng)目號(hào)if(i==build[j].num1){w=j;break;}if(w==101)printf("Cannotfindthedata!\n");{printf("所在城市名}}}查找配對(duì)?!痉治觥枯斎肱鋵?duì)方式(按配件號(hào),按銷售商號(hào)碼3N查找配對(duì)模3N查找配對(duì)模void{intx,j,i,a=0,b=0;intw;FILEprintf("1.By配件號(hào)\n");printf("2.By項(xiàng)目\n");printf("3.返回loop:printf("請(qǐng)選擇項(xiàng)if(x==3)elseif(x<1||x>3){printf("Error!");gotoelse{{printf("Cannotopenthe}printf("%d,}printf("%d,printf("\nPleaseinputthe配件號(hào):");{if(w==pj[j].num)printf("配件號(hào):%d銷售商號(hào):%d所在城市}else{}printf("已有項(xiàng)目號(hào)printf("\nPleaseinputthe項(xiàng)目號(hào):");{if(w==build[j].num1) 項(xiàng)目printf("\nPleaseinputthe項(xiàng)目號(hào):");{if(w==build[j].num1) 項(xiàng)目號(hào)}}銷商號(hào)所在城主菜單函主菜數(shù)據(jù)輸入模輸入副菜輸入副菜輸入數(shù)刪除模刪除模刪除模刪除模查找模查找模塊查找模(查找模(5)查找配對(duì)模查找配對(duì)模C的知識(shí)運(yùn)用到實(shí)際當(dāng)中去,費(fèi)了不少周折,但很有成C模塊化C的知識(shí)運(yùn)用到實(shí)際當(dāng)中去,費(fèi)了不少周折,但很有成C模塊化waring中,我對(duì)編程過程中的許多細(xì)節(jié)也越來越熟悉,語法上的小錯(cuò)誤越來越少,也為我2012221inti=0;FILEstruct{intnum1;intnum2;intnum3;intstruct{intnum;charcity[20];struct{intcharcity[20];struct{intcharcolor[20];intweight;chararea[20];struct{intnumcharstate[20];charcity[20];void數(shù)據(jù)輸入模塊void{intj;charc[2];FILE*fp;{printf("Cannotopenthefile!\n");}fread(&sal[j],sizeof(struct{printf("輸入數(shù)量r:\n");printf("Filewriteerror\n");elseloop:printf("是否繼續(xù)?(是printf("輸入數(shù)量r:\n");printf("Filewriteerror\n");elseloop:printf("是否繼續(xù)?(是[y]/否[n])\n");{{printf("error!\n");goto}}}void{intj;charc[2];FILE{printf("Cannotopenthefile!\n");}fwrite(&build[j],sizeof(struct{printf("輸入工地名printf("Filewriteerror\n");elseprintf("Filewriteerror\n");elseloop:printf("是否繼續(xù)?(是[y]/否[n])\n");{{printf("error!\n");goto}}}void{intj;charc[2];FILE{printf("Cannotopenthefile!\n");}fwrite(&pj[j],sizeof(struct{printf("輸入配件重量printf("輸入配件產(chǎn)地printf("Filewriteerror\n");printf("輸入配件產(chǎn)地printf("Filewriteerror\n");else{{printf("error!\n");goto}}}voidSET_enter{intj;charc[2];FILE{printf("Cannotopenthefile!\n");}fwrite(&sel[j],sizeof(struct{printf("Filewriteerror\n");elseprintf("Filewriteerror\n");else{{printf("error!\n");goto}}}void{int{puts("\t\t\t\t1.sal_enternewdata");puts("\t\t\t\t2.build_enternewdata");puts("\t\t\t\t3.pj_enternewdata");puts("\t\t\t\t4.SET_enternewdata");puts("\n\n\t\tprintf("Choosethenumber(1-5):[elset=0;}{casecase3:pj_enter();break;case4:SET_enter();break;case5:menu();}}void{case3:pj_enter();break;case4:SET_enter();break;case5:menu();}}void{intj,v=0;intx;int FILE{printf("Cannotopenthefile!\n");}if(x==0){if(fread(&sal[j],sizeof(structsale),1,fp)!=1)break;}{}{printf("Cannotfindthedata!\n\n");gotoloop;}{{if(j!=w)fwrite(&sal[j],sizeof(struct} printf("刪除成功} printf("刪除成功}void{intj,v=0,x;int FILE{printf("Cannotopenthefile!\n");}loop:printf("請(qǐng)輸入要?jiǎng)h除的工地號(hào)(0返回menu):");if(x==0){if(fread(&build[j],sizeof(structbuilding),1,fp)!=1)break;}{if(x==build[j].num){printf("Cannotfindthedata!\n\n");gotoloop;}{{if(j!=w)fwrite(&build[j],sizeof(struct}printf("\n項(xiàng)目號(hào),工地號(hào),工地名,城市名%d,printf("\n項(xiàng)目號(hào),工地號(hào),工地名,城市名%d,printf("刪除成功}void{intj,v=0,x;int FILE{printf("Cannotopenthefile!\n");}loop:printf("請(qǐng)輸入要?jiǎng)h除的配件號(hào)(0返回menu):");if(x==0){if(fread(&pj[j],sizeof(structpeijian),1,fp)!=1)break;}{if(x==pj[j].num){printf("Cannotfindthedata!\n\n");gotoloop;}{{if(j!=w)fwrite(&pj[j],sizeof(struct} printf("刪除成功} printf("刪除成功}voidSET_delete{intj,v=0;intx;int FILE{printf("Cannotopenthefile!\n");}loop:printf("請(qǐng)輸入號(hào)碼(0返回menu):");if(x==0){if(fread(&sel[j],sizeof(structseller),1,fp)!=1)break;}{if(x==sel[j].num){printf("Cannotfindthedata!\n\n");gotoloop;}{{if(j!=w)fwrite(&sel[j],sizeof(struct}printf("\n銷售商號(hào)碼,銷售商名字,狀態(tài),城市 printf("刪除成功}void printf("刪除成功}void{int{puts("\t\t\t1.sal_deletenewdata");puts("\t\t\t2.build_deletenewdata");puts("\t\t\t4.SET_deletenewdata");printf("Choosethenumber(1-5):[]\b\b");{t=1;getchar();else}{case1:sal_delete();break;case3:pj_delete();break;case4:SET_delete();break;case5:menu();}}voidsearch(){inti,w=101,j,x,h=0;FILEprintf("1--printf("2--printf("3--printf("4--項(xiàng)目號(hào)inti,w=101,j,x,h=0;FILEprintf("1--printf("2--printf("3--printf("4--項(xiàng)目號(hào)工地號(hào)配件號(hào) if(x==5)elseif(x<1||x>5){printf("Error!\n");gotoelse{{printf("Cannotopenthefile!\n");}printf("Pleaseinputthe配件號(hào):");if(i==pj[j].num)if(w==101)printf("Cannotfindthedata!\n");{printf("配件號(hào)printf("配件名printf("配件顏色printf("配件重量printf("配件產(chǎn)地}}else{{printf("Cannotopenthe}else{{printf("Ca
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 思考成就青春無畏
- 二零二五年度快遞配送與新能源車輛應(yīng)用合同3篇
- 2025版酒店與旅游軟件開發(fā)平臺(tái)合作協(xié)議3篇
- 二零二五年度抵押房產(chǎn)交易合同模板:細(xì)節(jié)完善保障交易3篇
- 二零二五年度互聯(lián)網(wǎng)醫(yī)療服務(wù)平臺(tái)合同
- 二零二五年度建筑垃圾運(yùn)輸與環(huán)保設(shè)施運(yùn)營(yíng)合同3篇
- 二零二五年度工傷賠償及心理康復(fù)服務(wù)合同3篇
- 二零二五年度合伙購(gòu)買房產(chǎn)投資管理服務(wù)合同3篇
- 《SYB創(chuàng)新創(chuàng)業(yè)》課件
- 二零二五年度企業(yè)戰(zhàn)略合作框架協(xié)議范本3篇
- 中學(xué)美育工作制度
- 2023年保安公司副總經(jīng)理年終總結(jié) 保安公司分公司經(jīng)理年終總結(jié)(5篇)
- 2023中?!督馄蕦W(xué)基礎(chǔ)》題庫(kù)202311593753185
- 化妝品生產(chǎn)許可申請(qǐng)表樣板
- 教科版三年級(jí)上冊(cè)科學(xué)教案(全冊(cè))
- 勞動(dòng)力安排計(jì)劃及勞動(dòng)力計(jì)劃表(樣板)
- 利潤(rùn)表4(通用模板)
- 教育評(píng)價(jià)學(xué)全套ppt課件完整版教學(xué)教程
- 注塑領(lǐng)班作業(yè)指導(dǎo)書
- ASTM B330-20 Standard Test Methods for Estimating Average Particle Size of Metal Powders and Related Compounds Using%2
- 血?dú)夥治黾芭R床應(yīng)用
評(píng)論
0/150
提交評(píng)論