儀器儀表管理系統(tǒng)—C語(yǔ)言課程設(shè)計(jì)_第1頁(yè)
儀器儀表管理系統(tǒng)—C語(yǔ)言課程設(shè)計(jì)_第2頁(yè)
儀器儀表管理系統(tǒng)—C語(yǔ)言課程設(shè)計(jì)_第3頁(yè)
儀器儀表管理系統(tǒng)—C語(yǔ)言課程設(shè)計(jì)_第4頁(yè)
儀器儀表管理系統(tǒng)—C語(yǔ)言課程設(shè)計(jì)_第5頁(yè)
已閱讀5頁(yè),還剩19頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、儀器儀表管理1.題目要求.【要求】 系統(tǒng)功能的基本要求:(1) 新的儀器儀表信息的錄入;(2) 在借出、歸還、維修時(shí)對(duì)儀器儀表信息的修改;(3) 對(duì)報(bào)廢儀器儀表信息的刪除;(4) 按照一定的條件查詢(xún)符合條件的儀器儀表信息;查詢(xún)功能至少應(yīng)該包括儀器儀表基本信息(如儀器儀表名字、儀器儀表編等)的查詢(xún)、按時(shí)間點(diǎn)(借入時(shí)間、借出時(shí)間、歸還時(shí)間)查詢(xún)等(5) 對(duì)查詢(xún)結(jié)果的輸出。 【提示】 數(shù)據(jù)結(jié)構(gòu)采用結(jié)構(gòu)體。儀器儀表信息包括儀器儀表名、儀器儀表編號(hào)、購(gòu)買(mǎi)時(shí)間、借入時(shí)間、借出時(shí)間、歸還時(shí)間、維修時(shí)間、狀態(tài)信息(0代表可借出,1代表已借出,2代表正在維修)等。.需求分析根據(jù)題目要求,需要把儀器儀表信息的的數(shù)

2、據(jù)存儲(chǔ)在文件里,所以需要提供文件的輸入輸出等操作;在程序中要提供修改,刪除,查找等操作;另外還應(yīng)該提供鍵盤(pán)式選擇菜單實(shí)現(xiàn)功能選擇。2.功能實(shí)現(xiàn)設(shè)計(jì)2.1總體設(shè)計(jì) 儀器儀表管理系統(tǒng)添加查詢(xún)修改刪除退出系統(tǒng)功能模塊圖2.2詳細(xì)設(shè)計(jì)1. 主函數(shù)主函數(shù)一般設(shè)計(jì)得比較簡(jiǎn)潔,只提供輸入輸出和功能處理的函數(shù)調(diào)用。其各功能模塊用菜單方式選擇。本題將main()函數(shù)體內(nèi)的界面選擇部分語(yǔ)句單獨(dú)抽取出來(lái)作為一獨(dú)立函數(shù),目的在于系統(tǒng)執(zhí)行完每部分功能模塊后能夠方便返回到系統(tǒng)界面?!境绦颉?main()menu();菜單部分設(shè)計(jì)如下:【流程圖】顯示一系列功能選項(xiàng) 輸入n,判斷n是否是17 N Y根據(jù)n的值調(diào)用各功能模塊函

3、數(shù) 主函數(shù)的菜單流程圖【程序】main()system("cls");/*清屏*/menu();void menu()int w,n;dosystem("cls");printf("tt WELCOME TO THE EQUIPMENT MANAGEMENT SYSTEMnnn");printf("nntt=*=nnn");printf("ttt1:Add message of new equipmennn");printf("ttt2:Load the message of all

4、equipmentnn");printf("ttt3:Correct the message of equipmentnn");printf("ttt4:Ddlete the message of broken equipmentnn");printf("ttt5:Search the message of equipmentnn");printf("ttt6:Search of all the equipmentnn");printf("ttt7:Exitn");printf(&qu

5、ot;nntt=*=nnn");printf("Please choice your number: bb");scanf("%d",&n);if(n<1|n>7) w=1;else w=0;while (w=1);/*選擇功能*/switch(n)case 1:add_new_message();break;/*添加模塊*/case 2:load_record();break;/*顯示模塊*/case 3:modify();break;/*修改模塊*/case 4:delete();break;/*刪除模塊*/case 5

6、:search();break;/*查詢(xún)模塊*/case 6:statistic();break;/*統(tǒng)計(jì)模塊*/case 7:exit(0);break;/*退出模塊*/2. 各功能模塊設(shè)計(jì)(1)添加模塊 【數(shù)據(jù)結(jié)構(gòu)】 【分析】 單獨(dú)看各數(shù)據(jù)信息,儀器儀表名是字符型,可采用字符型數(shù)組;儀器儀表編號(hào)、購(gòu)買(mǎi)時(shí)間、借入時(shí)間、借出時(shí)間、歸還時(shí)間、維修時(shí)間應(yīng)采用實(shí)型;狀態(tài)信息是整數(shù),采用整型。實(shí)際上操作時(shí)發(fā)現(xiàn)只有字符型的數(shù)據(jù)可以在文件中成功被保存,所以本題所有數(shù)據(jù)一律采用字符型。struct equipchar number4;char name11;char b_time11;char bin_ti

7、me11;char bout_time11;char giveb_time11;char repair_time11; /*time為下面程序中按時(shí)間查找和修改時(shí)記錄輸入的時(shí)間*/int state;equM;【注意】equM中的M是儀表儀器個(gè)數(shù),程序中采用宏定義的方式,可以隨時(shí)在源程序宏定義中改,本程序宏定義#define M 50。輸入用戶(hù)要輸入儀器的個(gè)數(shù)n 【流程圖】i從0到n1調(diào)用輸入函數(shù)input(i) i!0 Y調(diào)用保存函數(shù)save(n)輸入模塊流程圖【程序】/*添加模塊*/void add_new_message()int t,i,m;system("cls"

8、);t=load_equ();printf("How many groups datas do you want to add?n");printf("input the number: bbb");scanf("%d",&m);for(i=0;i<m;i+)printf("nInput %dth equipment record.n",i+1);input(t+i);/*調(diào)用輸入函數(shù)*/save(t+m,0);/*調(diào)用保存函數(shù) 保存t+m組數(shù)據(jù)*/system("cls");me

9、nu();/*返回登陸界面*/*輸入函數(shù)*/ void input(int i)printf("Please input:nnumber name b_time b_in_time b_out_time g_back_time repair_time staten");scanf("%s %s %s %s %s %s %s %d",&equi.number,&,&equi.b_time,&equi.bin_time,&equi.bout_time,&equi.giveb_time,&

10、;equi.repair_time,&equi.state);/*顯示記錄模塊*/void load_record()int t;t=load_equ();printf_n(t);printf("nnnPress any key to go back.nn");getchar();menu();/*顯示一個(gè)儀器記錄的函數(shù)*/void printf_one(int i)printf("%-3s %-10s %-10s %-10s %-10s %-10s %-10s %d.nn",equi.number,,equi.b_time,e

11、qui.bin_time,equi.bout_time,equi.giveb_time,equi.repair_time,equi.state);/*顯示n個(gè)儀器記錄的函數(shù)*/void printf_n(int n)int j;system("cls");/*清屏*/printf("number name b_time b_in_time b_out_time g_back_time repair_time sn");for(j=0;j<n;j+) if(j+1)%10=0)/*控制顯示,每屏顯示10行*/ printf("nnPass

12、any key to continue ."); getchar(); puts("nn"); printf_one(j);/*調(diào)用顯示一個(gè)儀器記錄的函數(shù)*/ (2)修改模塊需求分析 該模塊的功能是顯示所有儀器儀表信息,考慮到記錄較多,建議采用分屏顯示。顯示完所有記錄后,用戶(hù)輸入要修改的儀器儀表編號(hào),根據(jù)編號(hào)查找儀器儀表記錄,并提示用戶(hù)修改該記錄的哪部分信息,是儀器儀表的借出時(shí)間、歸還時(shí)間、修理時(shí)間還是狀態(tài),根據(jù)用戶(hù)選擇修改相應(yīng)信息。讓用戶(hù)選擇查詢(xún)方式(number or name)流程圖輸入number or name是否找到此記錄 Y N顯示找到的記錄,調(diào)用修

13、改函數(shù)提示沒(méi)有找到 返回主菜單詢(xún)問(wèn)用戶(hù)是否繼續(xù)修改修改模塊流程圖程序/*修改模塊*/void modify()struct equip mod;int t,i,m,w,addr=-1;char number4=' ', name11=' 'system("cls");/*清屏*/t=load_equ();doprintf("nInput the equipment'number or name ( 1:the number 2:the name ):nn");printf("What is your ch

14、oice: bb");scanf("%d",&m);if(m=1|m=2) w=0;else w=1;while(w=1);switch(m) case 1: printf("nnPlease input the equipment's number:_bbbb"); scanf("%s",number);break; case 2: printf("Please input the equipment's name:_bbbbbbbbbbb"); scanf("%s&q

15、uot;,name);break;for(i=0;i<t;i+)/*查找要修改的儀器*/ if(strcmp(,name)=0|strcmp(equi.number,number)=0) addr=i; printf("nnPlease input the new information:nn"); printf("number name b_time b_in_time b_out_time g_back_time repair_time sn"); scanf("%s%s%s%s%s%s%s%d",mod.

16、number,,mod.b_time,mod.bin_time,mod.bout_time,mod.giveb_time,mod.repair_time,&mod.state); strcpy(equi.number,mod.number);strcpy(,);strcpy(equi.b_time,mod.b_time);strcpy(equi.bin_time,mod.bin_time);strcpy(equi.bout_time,mod.bout_time); strcpy(equi.giveb_time,mod.giveb_tim

17、e);strcpy(equi.repair_time,mod.repair_time); equi.state=mod.state;printf("%-3s %-10s %-10s %-10s %-10s %-10s %-10s %d.nn",equi.number,,equi.b_time,equi.bin_time,equi.bout_time,equi.giveb_time,equi.repair_time,equi.state);break; if(addr=-1) printf(" Cannot find the equipment w

18、hich you want to modify!nn");printf(" Press any key to go back.nn"); getchar(); menu(); save(t,0);/*修改后的信息保存*/printf(" Press any key to go back.nn");getchar();menu();(3)查詢(xún)模塊顯示一系列功能選項(xiàng)流程圖輸入n,判斷n是否是1-4 N Y根據(jù)n的值調(diào)用各子功能模塊函數(shù)查詢(xún)模塊流程圖程序 /*查詢(xún)模塊*/void search()int w,n;dosystem("cls&

19、quot;);printf("ntt*nn");printf("ttby b_time quantum to search? Input1n");printf("ttby give_back_time quantum to search? Input2n");printf("ttby number to search? Input3n");printf("ttby name to search? Input4n");printf("tt*nn");printf("

20、Choice your number(1-4): bbb");scanf("%d",&n);if(n<1|n>4) w=1;else w=0;while (w=1);/*選擇功能*/switch(n)case 1:sb_buy_tq();break;/*按購(gòu)買(mǎi)時(shí)間段查詢(xún)函數(shù)*/case 2:sb_gb_tq();break;/*按歸還時(shí)間段查詢(xún)*/case 3:sb_par_number();break;/*按指定編號(hào)查詢(xún)*/case 4:sb_name();break;/*按儀器名稱(chēng)查詢(xún)*/void sb_buy_tq()/*按購(gòu)買(mǎi)時(shí)間段查詢(xún)

21、函數(shù)*/ char year111,year211; int t,i,sum=0; t=load_equ(); system("cls"); printf("Please input the start time:_._._bbbbbbbbbbb"); scanf("%s",year1); printf("n"); printf("Please input the finish time:_._._bbbbbbbbbbb"); scanf("%s",year2); print

22、f("n"); system("cls"); for(i=0;i<t;i+) if(strcmp(equi.b_time,year1)>=0)&&(strcmp(equi.b_time,year2)<=0) printf_one(i);/*把符合條件的記錄顯示出來(lái)*/ sum+; save_search_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ getch(); if(sum=0) system("cls"); printf("Sorry! Cannot find th

23、e equipment which you want to.nn"); getch(); printf("Press any key to go back the former step.n"); getchar(); menu();void sb_gb_tq()/*按購(gòu)買(mǎi)時(shí)間段查詢(xún)函數(shù)*/char year111,year211;int t,i,sum=0;t=load_equ();system("cls");printf("Please input the start time:_._._bbbbbbbbbbb");sc

24、anf("%s",year1);printf("n");printf("Please input the finish time:_._._bbbbbbbbbbb");scanf("%s",year2);printf("n");system("cls"); for(i=0;i<t;i+) if(strcmp(equi.giveb_time,year1)>=0)&&(strcmp(equi.b_time,year2)<=0) printf_on

25、e(i);/*把符合條件的記錄顯示出來(lái)*/ sum+; save_search_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ getch(); if(sum=0) system("cls"); printf("*nn"); printf("Sorry! Cannot find the equipment which you want to.nn"); printf("*nn"); getch(); printf("Press any key to go back the former s

26、tep.n"); getchar(); menu();void sb_par_number()/*按指定編號(hào)查詢(xún)*/char number4;int t,i,sum=0;t=load_equ();system("cls");printf("Please input the equipment number(000999):_bbbb");scanf("%s",number);printf("n"); system("cls"); for(i=0;i<t;i+) if(strcmp

27、(equi.number,number)=0) printf_one(i);/*把符合條件的記錄顯示出來(lái)*/ sum+; save_search_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ getch(); if(sum=0) system("cls"); printf("Sorry! Cannot find the equipment which you want to.nn"); getch(); printf("Press any key to go back the former step.n"); get

28、char(); menu();void sb_name()/*按儀器名稱(chēng)查詢(xún)*/char name11;int t,i,sum=0;t=load_equ();system("cls");printf("Please input the equipment name:_bbbbbbbbbbb");scanf("%s",name);printf("n");system("cls"); for(i=0;i<t;i+) if(strcmp(,name)=0) printf_one

29、(i);/*把符合條件的記錄顯示出來(lái)*/ sum+; save_search_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ getch(); if(sum=0) system("cls"); printf("Sorry! Cannot find the equipment which you want to.nn"); getch(); printf("Press any key to go back the former step.n"); getchar(); menu();(4)刪除模塊需求分析 該模塊的功能與

30、修改模塊一樣先顯示所有儀器儀表信息,同樣考慮到記錄較多,建議采用分屏顯示。顯示完所有記錄后,用戶(hù)輸入要修改的儀器儀表編號(hào),根據(jù)編號(hào)查找儀器儀表記錄,并提示用戶(hù)是否確定要?jiǎng)h除。讓用戶(hù)選擇如何搜尋記錄(by number or by name)流程圖輸入要?jiǎng)h除的儀器編號(hào)或名稱(chēng)是否找到此記錄 Y N顯示找到的記錄提示沒(méi)有找到刪除 并保存未刪除的記錄刪除 保存為刪除的記 返回主菜單刪除模塊流程圖程序 /*刪除模塊*/3. void delete1()4. 5. FILE *fp1;6. /struct equip mod;7. int t,i,m,w,addr=-1;8. char number4=&

31、#39; ', name11=' '9. /char a12,a22;10. system("cls");/*清屏*/11. t=load_equ();12. if(fp1=fopen("record.txt","w")=NULL)/*以只寫(xiě)方式打開(kāi)*/13. 14. printf("nCannot open filen");15. exit(0);16. 17. system("cls");18. do19. 20. system("cls");21

32、. printf("nPlease Input the equipment'number or name to find it( 1:the number 2:the name ):nn");22. printf("What is your choice: bb");23. scanf("%d",&m);24. if(m=1|m=2)25. w=0;26. else27. w=1;28. while(w=1);29.30. switch(m)31. 32. case 1:33. printf("nnPleas

33、e input the equipment's number:(_)bbbb");34. scanf("%s",number);break;35. case 2:36. printf("Please input the equipment's name:(_)bbbbbbbbbbb");37. scanf("%s",name);break;38. 39.40. for(i=0;i<t;i+)/*查找要?jiǎng)h除的儀器*/41. 42. if(strcmp(,name)=0|strcmp(eq

34、ui.number,number)=0)43. 44. addr=i;45. system("cls");46. printf("%-3s %-10s %-10s %-10s %-10s %-10s %-10s %d.nn",equi.number,,equi.b_time,equi.bin_time,equi.bout_time,equi.giveb_time,equi.repair_time,equi.state); getch(); system("cls");printf("Congratunati

35、ons ! You have been successful to delete it's information. _n"); getch();continue;fwrite(&equi,sizeof(struct equip),1,fp1);/*把不想刪除的保存在記事本里,想刪除的不保存即為刪除*/fclose(fp1);/*關(guān)閉文件*/if(addr=-1) system("cls");printf(" Cannot find the equipment which you want to delete!nn");getc

36、h(); printf(" nnnPress any key to go back.nn");getchar();menu();(6) 統(tǒng)計(jì)模塊 按要求可按時(shí)間段統(tǒng)計(jì) 按基本信息統(tǒng)計(jì) 并保存至統(tǒng)計(jì)記錄文檔 流程圖類(lèi)似查詢(xún)模塊/*統(tǒng)計(jì)模塊*/ void statistic()int w,n;dosystem("cls");printf("ntt*nn");printf("ttby b_time quantum to statistic? Input1n");printf("ttby give_back_ti

37、me quantum to statistic? Input2n");printf("ttby number to statistic? Input3n");printf("ttby name to statistic? Input4n");printf("tt*nn");printf(" Choice your number(1-4): bbb");scanf("%d",&n);if(n<1|n>4) w=1;else w=0;while (w=1);/*選擇功能

38、*/switch(n)case 3:tb_par_number();break;case 4:tb_name();break;case 1:tb_buy_tq();break;case 2:tb_gb_tq();break;void tb_par_number()char number4;int t,i,sum=0;t=load_equ();system("cls");printf("Please input the equipment number(000999):_bbbb");scanf("%s",number);printf(

39、"n"); for(i=0;i<t;i+) if(strcmp(equi.number,number)=0) sum+; save_statistic_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ if(sum=0) system("cls"); printf(" Sorry! Cannot find the equipment which you want to!nn"); getch(); else system("cls");printf(" There are%-2dequ

40、ipment(s) which you want to statistic in the record!nn",sum);getch(); printf("Press any key to go back the former step.n"); getchar(); menu();void tb_name()char name11;int t,i,sum=0;t=load_equ();system("cls");printf("Please input the equipment name:_bbbbbbbbbbb");s

41、canf("%s",name);printf("n"); for(i=0;i<t;i+) if(strcmp(,name)=0) sum+; save_statistic_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ if(sum=0) system("cls");printf(" Sorry! Cannot find the equipment which you want to!nn");getch(); else system("cls");pri

42、ntf(" There are%-2dequipment(s) which you want to statistic in the record!nn",sum);getch(); printf("Press any key to go back the former step.n"); getchar(); menu();void tb_buy_tq()char year111,year211;int t,i,sum=0;t=load_equ();system("cls");printf("Please input th

43、e start time:_._._bbbbbbbbbbb");scanf("%s",year1);printf("n");printf("Please input the finish time:_._._bbbbbbbbbbb");scanf("%s",year2);printf("n"); for(i=0;i<t;i+) if(strcmp(equi.b_time,year1)>=0)&&(strcmp(equi.b_time,year2)<=0

44、) sum+; save_statistic_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ if(sum=0) system("cls");printf("*nn");printf(" Sorry! Cannot find the equipment which you want to!nn");printf("*nn");getch(); else system("cls");printf("*nn");printf(" There are%-2

45、dequipment(s) which you want to statistic in the record!nn",sum);printf("*nnnn");getch(); printf("Press any key to go back the former step.n"); getchar(); menu();void tb_gb_tq()char year111,year211;int t,i,sum=0;t=load_equ();system("cls");printf("Please input

46、the start time:_._._bbbbbbbbbbb");scanf("%s",year1);printf("n");printf("Please input the finish time:_._._bbbbbbbbbbb");scanf("%s",year2);printf("n"); for(i=0;i<t;i+) if(strcmp(equi.giveb_time,year1)>=0)&&(strcmp(equi.giveb_time,ye

47、ar2)<=0) sum+; save_statistic_record(i);/*把符合條件的記錄保存在查詢(xún)記事本里*/ if(sum=0) system("cls"); printf("*nn"); printf(" Sorry! Cannot find the equipment which you want to!nn"); printf("*nn"); getch(); else system("cls"); printf("*nn"); printf(&qu

48、ot; There are%-2dequipment(s) which you want to statistic in the record!nn",sum); printf("*nnnn"); getch(); printf("Press any key to go back the former step.n"); getchar(); menu(); (7)顯示記錄模塊 /*顯示記錄模塊*/void load_record()int t;t=load_equ();printf_n(t);system("cls");p

49、rintf("nnnPress any key to go back.nn");getch();getchar();menu(); 公共函數(shù)下面是在每個(gè)功能模塊中都有可能用到的一些公共函數(shù)。(1) 保存函數(shù)save(int n)(2) void save(int n,int m)/*n表示保存n組數(shù)據(jù),m表示保存在哪個(gè)文件夾里*/(3) (4) FILE *fp;(5) int i;(6) if(m=0)(7) fp=fopen("record.txt","w");/*以只寫(xiě)方式打開(kāi)*/(8) else if(m=1)(9) fp=fopen("search_record.txt","w");(10) else(11)

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論