C語言課程設(shè)計(jì)汽車零部件質(zhì)檢管理系統(tǒng)_第1頁
C語言課程設(shè)計(jì)汽車零部件質(zhì)檢管理系統(tǒng)_第2頁
C語言課程設(shè)計(jì)汽車零部件質(zhì)檢管理系統(tǒng)_第3頁
C語言課程設(shè)計(jì)汽車零部件質(zhì)檢管理系統(tǒng)_第4頁
C語言課程設(shè)計(jì)汽車零部件質(zhì)檢管理系統(tǒng)_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、 HUBEI UNIVERSITY OF AUTOMOTIVE TECHNOLOGYC語言程序設(shè)計(jì)實(shí)訓(xùn)報(bào)告實(shí)訓(xùn)題目: 汽車零部件質(zhì)檢管理系統(tǒng) 專 業(yè): 班 級(jí): 姓 名: 成 績: 完成日期: 指導(dǎo)教師: 課設(shè)報(bào)告內(nèi)容:一、-設(shè)計(jì)題目與要求二、-系統(tǒng)設(shè)計(jì)三、-程序測試與運(yùn)行結(jié)果四、-實(shí)訓(xùn)總結(jié)五、-程序源代碼一、課設(shè)題目與要求:汽車零部件質(zhì)檢管理程序題目描述已知在汽車零部件生產(chǎn)過程中,需要對(duì)生產(chǎn)的零部件進(jìn)行質(zhì)量檢測,保證生產(chǎn)質(zhì)量,以便對(duì)出現(xiàn)生產(chǎn)質(zhì)量問題的責(zé)任人進(jìn)行考核,設(shè)計(jì)一個(gè)汽車零部件質(zhì)檢管理程序,該程序應(yīng)該具有完成如下功能:(1)能從鍵盤輸入質(zhì)檢信息。(2)指定質(zhì)檢編號(hào),顯示質(zhì)檢信息。(3)

2、指定生產(chǎn)者,顯示質(zhì)檢信息。(4)指定質(zhì)檢編號(hào),修改質(zhì)檢信息。(5)指定質(zhì)檢編號(hào),刪除質(zhì)檢信息。 題目要求:(1)按照分析、設(shè)計(jì)、編碼、調(diào)試、測試的軟件過程完成這個(gè)應(yīng)用程序。(2) 質(zhì)檢信息包括:質(zhì)檢編號(hào)、零部件名稱、生產(chǎn)者、生產(chǎn)部門、質(zhì)檢結(jié)果(合格/不合格)、質(zhì)量問題(設(shè)計(jì)缺陷/裝配質(zhì)量/加工質(zhì)量)、質(zhì)檢員、質(zhì)檢日期。(3) 為程序設(shè)計(jì)windows窗口,在該窗口上以按鈕的形式為用戶提供“菜單”,通過點(diǎn)擊各個(gè)功能項(xiàng)對(duì)應(yīng)的按鈕完成操作。輸入要求: (1)用戶可以根據(jù)需求,選定相應(yīng)的操作項(xiàng)目。進(jìn)入每個(gè)操作后,通過窗口的文本框,從鍵盤輸入相應(yīng)的信息。程序根據(jù)用戶輸入的信息完成相應(yīng)的處理,實(shí)現(xiàn)要求的功

3、能。 (2)能對(duì)輸入的數(shù)據(jù)進(jìn)行簡單的校驗(yàn),例如,質(zhì)檢日期必須是一個(gè)合法的日期格式,質(zhì)檢編號(hào)是唯一的(一個(gè)質(zhì)檢編號(hào)對(duì)應(yīng)一次質(zhì)檢的質(zhì)檢信息)。輸出要求: (1)應(yīng)用程序運(yùn)行后,要在屏幕上顯示一個(gè)按鈕形式的“菜單”。 (2)要求用戶輸入數(shù)據(jù)時(shí),給出清晰、明確的提示信息,包括輸入的數(shù)據(jù)內(nèi)容、格式以及結(jié)束方式等。(3)在程序完成處理后,要清楚地給出程序的處理結(jié)果。例如,在給定質(zhì)檢編號(hào)刪除質(zhì)檢信息時(shí),如果該質(zhì)檢信息不存在,要提示沒能刪除,如果刪除成功要提示刪除成功。實(shí)現(xiàn)要求: (1)在程序中使用鏈表存儲(chǔ)質(zhì)檢信息。 (2)采用模塊化程序設(shè)計(jì)的方法,將程序中的各項(xiàng)功能用函數(shù)實(shí)現(xiàn)。提示: (1)使用結(jié)構(gòu)體表示質(zhì)

4、檢信息,一個(gè)結(jié)點(diǎn)保存一條質(zhì)檢信息。 擴(kuò)展功能: (1)提供一些統(tǒng)計(jì)功能。例如統(tǒng)計(jì)生產(chǎn)者質(zhì)檢不合格的次數(shù),統(tǒng)計(jì)各種質(zhì)量問題出現(xiàn)次數(shù)。 (2)質(zhì)檢信息從文件讀入。 (3)將質(zhì)檢信息保存到文件中。二、系統(tǒng)設(shè)計(jì)(1)系統(tǒng)功能模塊劃分讀取文件輸入質(zhì)檢信息通過質(zhì)檢編號(hào)顯示質(zhì)檢信息通過生產(chǎn)者顯示質(zhì)檢信息指定質(zhì)檢編號(hào)修改信息指定質(zhì)檢編號(hào)刪除信息保存文件(2)主函數(shù)的流程分析與設(shè)計(jì)統(tǒng)計(jì)保存文件指定質(zhì)檢編號(hào)刪除質(zhì)檢信息指定質(zhì)檢編號(hào)顯示質(zhì)檢信息通過生產(chǎn)者顯示質(zhì)檢信息通過質(zhì)檢編號(hào)顯示質(zhì)檢信息輸入質(zhì)檢信息讀入文件菜單三、程序測試與運(yùn)行結(jié)果void menu() /菜單 system("cls");s

5、ystem("color f0");printf("ttt*n");printf("ttt* 菜單 *n");printf("ttt*n");printf("ttt* 1.讀入文件 *n");printf("ttt* 2.輸入質(zhì)檢信息 *n");printf("ttt* 3.通過質(zhì)檢編號(hào)顯示質(zhì)檢信息 *n");printf("ttt* 4.通過生產(chǎn)者顯示質(zhì)檢信息 *n");printf("ttt* 5.指定質(zhì)檢編號(hào)修改信息 *

6、n");printf("ttt* 6.指定質(zhì)檢編號(hào)刪除信息 *n");printf("ttt* 7.統(tǒng)計(jì) *n");printf("ttt* 8.保存文件 *n");printf("ttt* 0.退出 *n");printf("ttt*n");printf("ttt 請(qǐng)輸入選項(xiàng)(07):");void readFile() / 讀取文件FILE *fp;struct qualityTesting *sp,*newp,*sp2;fp = fopen("dat

7、a.txt","r");if(fp = NULL) printf("文件打開失敗!"); exit(0);headp = (struct qualityTesting *) malloc(sizeof(struct qualityTesting);headp->next = NULL;sp =headp; while(!feof(fp) newp = (struct qualityTesting *) malloc(sizeof(struct qualityTesting);fscanf(fp,"%d%s%s%s%s%s%s%s

8、 ",&(newp->quality_number),&(newp->part_name),&(newp->producer),&(newp->production),&(newp->result),&(newp->problem),&(newp->quality_person),&(newp->data);count+;newp->next = NULL;sp->next = newp;sp = sp->next; sp->next = NULL;

9、headp1 = sp;fclose(fp);printf("計(jì)數(shù)器:%dn",count); printf("文件錄入成功!n");sp2=headp->next;while(sp2!=NULL)printf("%d %s %s %s %s %s %s %s n",sp2->quality_number,sp2->part_name,sp2->producer,sp2->production,sp2->result,sp2->problem,sp2->quality_person,sp

10、2->data);sp2=sp2->next; system("pause");void input() /輸入質(zhì)檢信息 struct qualityTesting *sp,*newp;int cho=1;sp = headp1;while(cho != 0) newp = (struct qualityTesting *) malloc(sizeof(struct qualityTesting);printf("請(qǐng)輸入質(zhì)檢信息n");printf("質(zhì)檢編號(hào):");scanf("%d",&(n

11、ewp->quality_number);printf("零件名稱:");scanf("%s",&(newp->part_name);printf("生產(chǎn)者:");scanf("%s",&(newp->producer);printf("生產(chǎn)部門:");scanf("%s",&(newp->production);printf("質(zhì)檢結(jié)果(合格/不合格):");scanf("%s",&am

12、p;(newp->result);printf("質(zhì)檢問題(設(shè)計(jì)缺陷/裝配質(zhì)量/加工質(zhì)量):");scanf("%s",&(newp->problem);printf("質(zhì)檢員:");scanf("%s",&(newp->quality_person);printf("質(zhì)檢日期:");scanf("%s",&(newp->data);newp->next = NULL;sp->next = newp;sp=sp-&g

13、t;next;count+;printf("繼續(xù)輸入請(qǐng)輸入數(shù)字鍵(退出:0)");scanf("%d",&cho);sp->next = NULL;void quality_number_search() /通過質(zhì)檢編號(hào)顯示質(zhì)檢信息 struct qualityTesting *sp;int number;sp = headp->next;printf("n請(qǐng)輸入質(zhì)檢編號(hào):");scanf("%d",&number);while(sp != NULL) if(sp->quality

14、_number = number) printf("%d %s %s %s %s %s %s %s n",sp->quality_number,sp->part_name,sp->producer,sp->production,sp->result,sp->problem,sp->quality_person,sp->data);break;sp = sp->next;system("pause");void producer_search() /通過生產(chǎn)者顯示質(zhì)檢信息 struct qualityT

15、esting *sp;char name10;sp = headp->next;printf("n請(qǐng)輸入生產(chǎn)者:");scanf("%s",&name);while(sp != NULL) if(strcmp(sp->producer,name) = 0) printf("%d %s %s %s %s %s %s %s n",sp->quality_number,sp->part_name,sp->producer,sp->production,sp->result,sp->pr

16、oblem,sp->quality_person,sp->data);break;sp = sp->next;system("pause");void quality_number_change() /指定質(zhì)檢編號(hào)修改信息 struct qualityTesting *sp;int number;sp = headp->next;printf("n請(qǐng)輸入質(zhì)檢編號(hào):");scanf("%d",&number);while(sp != NULL) if(sp->quality_number = num

17、ber)printf("請(qǐng)輸入質(zhì)檢信息n"); printf("質(zhì)檢編號(hào):"); scanf("%d",&(sp->quality_number); printf("零件名稱:"); scanf("%s",&(sp->part_name); printf("生產(chǎn)者:"); scanf("%s",&(sp->producer); printf("生產(chǎn)部門:"); scanf("%s&qu

18、ot;,&(sp->production); printf("質(zhì)檢結(jié)果(合格/不合格):"); scanf("%s",&(sp->result); printf("質(zhì)檢問題(設(shè)計(jì)缺陷/裝配質(zhì)量/加工質(zhì)量):"); scanf("%s",&(sp->problem); printf("質(zhì)檢員:"); scanf("%s",&(sp->quality_person); printf("質(zhì)檢日期:"); s

19、canf("%s",&(sp->data); break;sp = sp->next;printf("修改成功!");system("pause");void quality_number_delete() /指定質(zhì)檢編號(hào)刪除信息 struct qualityTesting *sp,*fellowp;int number;sp = headp->next;fellowp = headp;printf("n請(qǐng)輸入質(zhì)檢編號(hào):");scanf("%d",&number

20、);while(sp != NULL) if(sp->quality_number = number) fellowp->next = sp->next;free(sp); flag=1;count-; break;fellowp = sp;sp = sp->next;if(flag = 1) printf("刪除成功!");else printf("刪除失敗!");system("pause");void saveFile() /保存文件struct qualityTesting *sp,*fellowp;F

21、ILE *fp2;sp = headp->next;fellowp = headp;fp2 = fopen("data.txt","w");while(sp != NULL) fprintf(fp2,"%d %s %s %s %s %s %s %s n",sp->quality_number,sp->part_name,sp->producer,sp->production,sp->result,sp->problem,sp->quality_person,sp->data);fe

22、llowp = sp;sp = sp->next;free(fellowp);printf("保存成功!(鏈表清空完畢)");system("pause");void add() /統(tǒng)計(jì)struct qualityTesting *sp;sp = headp->next;while(sp != NULL) if(strcmp(sp->result,"不合格") = 0)a+;if(strcmp(sp->problem,"設(shè)計(jì)缺陷") = 0)b+;if(strcmp(sp->probl

23、em,"裝配質(zhì)量") = 0)c+;if(strcmp(sp->problem,"加工質(zhì)量") = 0)d+;sp = sp->next;printf("不合格次數(shù):%dn",a);printf("設(shè)計(jì)缺陷次數(shù):%dn",b);printf("裝配質(zhì)量次數(shù):%dn",c);printf("加工質(zhì)量次數(shù):%dn",d);system("pause");四、實(shí)訓(xùn)總結(jié) 通過本次實(shí)訓(xùn),我發(fā)現(xiàn)我在c語言的學(xué)習(xí)上還存在很多的問題,而且對(duì)于一些基礎(chǔ)知識(shí)的掌握

24、還是不夠熟練,本次實(shí)訓(xùn)的代碼中很多地方都需要用到鏈表的知識(shí),但是我發(fā)現(xiàn)我對(duì)鏈表的掌握很差,而且代碼中的鏈表方面的知識(shí)還是在同學(xué)的的幫助下完成的,所以,在本次實(shí)訓(xùn)過后我發(fā)現(xiàn)我對(duì)鏈表方面知識(shí)的掌握有了進(jìn)一步的提高。 而且在本次實(shí)訓(xùn)中,我發(fā)現(xiàn)c語言的學(xué)習(xí)其實(shí)并不是原來想象的那么難,只要對(duì)一些基本的知識(shí)點(diǎn)掌握的比較熟練了之后,對(duì)于一些簡單的程序都可以很好的獨(dú)立完成。所以作為一個(gè)計(jì)算機(jī)專業(yè)的學(xué)生,在以后的學(xué)習(xí)和其他各類計(jì)算機(jī)語言中,我要加強(qiáng)對(duì)基礎(chǔ)知識(shí)的掌握,平時(shí)勤加練習(xí),爭取今早的掌握。 同時(shí)在本次實(shí)訓(xùn)中,我也遇到了一些困難和問題,但同時(shí)我也學(xué)會(huì)了一些面對(duì)困難時(shí)所必須的態(tài)度,這都是本次實(shí)訓(xùn)所帶給我的。最

25、后,我想說,雖然我的c語言基礎(chǔ)不是很好,但是,我相信,只要我肯努力,我的c語言成績肯定會(huì)更進(jìn)一步的。五、程序源代碼#include<stdio.h>#include<stdlib.h>#include<string.h>#include<windows.h>struct qualityTesting /結(jié)構(gòu)體:質(zhì)檢信息int quality_number; /質(zhì)檢編號(hào)char part_name20; /零件名稱char producer30; /生產(chǎn)者char production30; /生產(chǎn)部門char result10; /質(zhì)檢結(jié)果(合格

26、/不合格)char problem30; /質(zhì)檢問題(設(shè)計(jì)缺陷/裝配質(zhì)量/加工質(zhì)量)char quality_person30; /質(zhì)檢員char data30; /質(zhì)檢日期struct qualityTesting *next;struct qualityTesting *headp,*headp1; /頭結(jié)點(diǎn)int count=0; /計(jì)數(shù)器int flag =0; /判斷刪除是否成功int a=0; /統(tǒng)計(jì)不合格數(shù)量int b=0,c=0,d=0; /統(tǒng)計(jì)各種質(zhì)量問題出現(xiàn)次數(shù)void menu() /菜單 system("cls");system("colo

27、r f0");printf("ttt*n");printf("ttt* 菜單 *n");printf("ttt*n");printf("ttt* 1.讀入文件 *n");printf("ttt* 2.輸入質(zhì)檢信息 *n");printf("ttt* 3.通過質(zhì)檢編號(hào)顯示質(zhì)檢信息 *n");printf("ttt* 4.通過生產(chǎn)者顯示質(zhì)檢信息 *n");printf("ttt* 5.指定質(zhì)檢編號(hào)修改信息 *n");printf(

28、"ttt* 6.指定質(zhì)檢編號(hào)刪除信息 *n");printf("ttt* 7.統(tǒng)計(jì) *n");printf("ttt* 8.保存文件 *n");printf("ttt* 0.退出 *n");printf("ttt*n");printf("ttt 請(qǐng)輸入選項(xiàng)(07):");void readFile() / 讀取文件FILE *fp;struct qualityTesting *sp,*newp,*sp2;fp = fopen("data.txt",&quo

29、t;r");if(fp = NULL) printf("文件打開失敗!"); exit(0);headp = (struct qualityTesting *) malloc(sizeof(struct qualityTesting);headp->next = NULL;sp =headp; while(!feof(fp) newp = (struct qualityTesting *) malloc(sizeof(struct qualityTesting);fscanf(fp,"%d%s%s%s%s%s%s%s ",&(ne

30、wp->quality_number),&(newp->part_name),&(newp->producer),&(newp->production),&(newp->result),&(newp->problem),&(newp->quality_person),&(newp->data);count+;newp->next = NULL;sp->next = newp;sp = sp->next; sp->next = NULL;headp1 = sp;fclo

31、se(fp);printf("計(jì)數(shù)器:%dn",count); printf("文件錄入成功!n");sp2=headp->next;while(sp2!=NULL)printf("%d %s %s %s %s %s %s %s n",sp2->quality_number,sp2->part_name,sp2->producer,sp2->production,sp2->result,sp2->problem,sp2->quality_person,sp2->data);sp2=

32、sp2->next; system("pause");void input() /輸入質(zhì)檢信息 struct qualityTesting *sp,*newp;int cho=1;sp = headp1;while(cho != 0) newp = (struct qualityTesting *) malloc(sizeof(struct qualityTesting);printf("請(qǐng)輸入質(zhì)檢信息n");printf("質(zhì)檢編號(hào):");scanf("%d",&(newp->quality_

33、number);printf("零件名稱:");scanf("%s",&(newp->part_name);printf("生產(chǎn)者:");scanf("%s",&(newp->producer);printf("生產(chǎn)部門:");scanf("%s",&(newp->production);printf("質(zhì)檢結(jié)果(合格/不合格):");scanf("%s",&(newp->resu

34、lt);printf("質(zhì)檢問題(設(shè)計(jì)缺陷/裝配質(zhì)量/加工質(zhì)量):");scanf("%s",&(newp->problem);printf("質(zhì)檢員:");scanf("%s",&(newp->quality_person);printf("質(zhì)檢日期:");scanf("%s",&(newp->data);newp->next = NULL;sp->next = newp;sp=sp->next;count+;pr

35、intf("繼續(xù)輸入請(qǐng)輸入數(shù)字鍵(退出:0)");scanf("%d",&cho);sp->next = NULL;void quality_number_search() /通過質(zhì)檢編號(hào)顯示質(zhì)檢信息 struct qualityTesting *sp;int number;sp = headp->next;printf("n請(qǐng)輸入質(zhì)檢編號(hào):");scanf("%d",&number);while(sp != NULL) if(sp->quality_number = number

36、) printf("%d %s %s %s %s %s %s %s n",sp->quality_number,sp->part_name,sp->producer,sp->production,sp->result,sp->problem,sp->quality_person,sp->data);break;sp = sp->next;system("pause");void producer_search() /通過生產(chǎn)者顯示質(zhì)檢信息 struct qualityTesting *sp;char

37、name10;sp = headp->next;printf("n請(qǐng)輸入生產(chǎn)者:");scanf("%s",&name);while(sp != NULL) if(strcmp(sp->producer,name) = 0) printf("%d %s %s %s %s %s %s %s n",sp->quality_number,sp->part_name,sp->producer,sp->production,sp->result,sp->problem,sp->qua

38、lity_person,sp->data);break;sp = sp->next;system("pause");void quality_number_change() /指定質(zhì)檢編號(hào)修改信息 struct qualityTesting *sp;int number;sp = headp->next;printf("n請(qǐng)輸入質(zhì)檢編號(hào):");scanf("%d",&number);while(sp != NULL) if(sp->quality_number = number)printf("

39、;請(qǐng)輸入質(zhì)檢信息n"); printf("質(zhì)檢編號(hào):"); scanf("%d",&(sp->quality_number); printf("零件名稱:"); scanf("%s",&(sp->part_name); printf("生產(chǎn)者:"); scanf("%s",&(sp->producer); printf("生產(chǎn)部門:"); scanf("%s",&(sp->

40、;production); printf("質(zhì)檢結(jié)果(合格/不合格):"); scanf("%s",&(sp->result); printf("質(zhì)檢問題(設(shè)計(jì)缺陷/裝配質(zhì)量/加工質(zhì)量):"); scanf("%s",&(sp->problem); printf("質(zhì)檢員:"); scanf("%s",&(sp->quality_person); printf("質(zhì)檢日期:"); scanf("%s&qu

41、ot;,&(sp->data); break;sp = sp->next;printf("修改成功!");system("pause");void quality_number_delete() /指定質(zhì)檢編號(hào)刪除信息 struct qualityTesting *sp,*fellowp;int number;sp = headp->next;fellowp = headp;printf("n請(qǐng)輸入質(zhì)檢編號(hào):");scanf("%d",&number);while(sp != NULL) if(sp->quality_number = number) fellowp->next = sp->next;free(sp); flag=1;count-; break;fellowp = sp;sp = sp->next;if(flag = 1) printf(&

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論