C語(yǔ)言綜合設(shè)計(jì)報(bào)告(共27頁(yè))_第1頁(yè)
C語(yǔ)言綜合設(shè)計(jì)報(bào)告(共27頁(yè))_第2頁(yè)
C語(yǔ)言綜合設(shè)計(jì)報(bào)告(共27頁(yè))_第3頁(yè)
C語(yǔ)言綜合設(shè)計(jì)報(bào)告(共27頁(yè))_第4頁(yè)
C語(yǔ)言綜合設(shè)計(jì)報(bào)告(共27頁(yè))_第5頁(yè)
已閱讀5頁(yè),還剩22頁(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、精選優(yōu)質(zhì)文檔-傾情為你奉上昆明理工大學(xué)C程序設(shè)計(jì)基礎(chǔ)課程綜合設(shè)計(jì)實(shí)踐教學(xué)課題報(bào)告組長(zhǎng): 學(xué)號(hào) * 姓名*組員: 學(xué)號(hào) * 姓名*學(xué)號(hào) * 姓名*學(xué)號(hào) * 姓名*學(xué)號(hào) * 姓名*學(xué)號(hào) * 姓名*聯(lián)系人及聯(lián)系電話: * 學(xué)院: 理學(xué)院 專(zhuān)業(yè)班級(jí): 電信111 指導(dǎo)教師: * 昆明理工大學(xué)計(jì)算中心2012年5月30日昆明理工大學(xué)計(jì)算中心程序設(shè)計(jì)基礎(chǔ)課程綜合設(shè)計(jì)實(shí)踐教學(xué)課題考核表課題名稱(chēng): 學(xué)生成績(jī)管理系統(tǒng) 學(xué)院:理學(xué)院 專(zhuān)業(yè)班級(jí):電信111學(xué)號(hào)姓名小組編號(hào)題號(hào)承擔(dān)及完成的內(nèi)容成績(jī)備注小組自評(píng)教師評(píng)定9*顯示函數(shù)與信息刪除函數(shù)設(shè)計(jì)7*main()函數(shù)與數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)1*信息錄入函數(shù)與排序函數(shù)設(shè)計(jì)1*查詢(xún)

2、函數(shù)設(shè)計(jì)5*插入函數(shù)設(shè)計(jì)6*按學(xué)號(hào)排序函數(shù)與按總分排序函數(shù)設(shè)計(jì)題目及要求學(xué)生成績(jī)管理系統(tǒng)用C語(yǔ)言編程實(shí)現(xiàn)學(xué)生成績(jī)的錄入、查詢(xún)、添加、排序、刪除等功能。教師評(píng)語(yǔ)教師簽名:* 2012年6月10日 C程序設(shè)計(jì)課程綜合設(shè)計(jì)實(shí)踐教學(xué)課題報(bào)告1、 系統(tǒng)概述本學(xué)生成績(jī)管理系統(tǒng)主要解決學(xué)生成績(jī)的錄入、查詢(xún)、添加、排序、刪除等問(wèn)題。主要通過(guò)建立鏈表、插入結(jié)點(diǎn)、刪除鏈表中的結(jié)點(diǎn)、輸出鏈表、定義函數(shù)等方式實(shí)現(xiàn)預(yù)期的功能。2、數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)#include <stdio.h>#include <stdlib.h>#include <malloc.h>#define LEN size

3、of(Student)#define NULL 0typedef struct studentint num; /*定義變量:學(xué)號(hào)*/char name20; /*定義變量:姓名*/char sex2; /*定義變量:性別*/int score3; /*定義變量:成績(jī)*/int sum; /*定義變量:總成績(jī)*/struct student *next;Student;int n; /*定義全局變量*/Student *cin(void); /*函數(shù)聲明:信息錄入函數(shù)*/Student *sort_1(Student *head,int); /*函數(shù)聲明:按學(xué)號(hào)排序函數(shù)*/void sort_

4、2(Student *head); /*函數(shù)聲明:按總分排序函數(shù)*/void print(Student *head); /*函數(shù)聲明:顯示函數(shù)*/Student *sort_all(Student *head); /*函數(shù)聲明:排序函數(shù)*/void find(Student *head); /*函數(shù)聲明:查詢(xún)函數(shù)*/Student *add_new(Student *head); /*函數(shù)聲明:插入函數(shù)*/3、模塊設(shè)計(jì)設(shè)計(jì)職責(zé)分配設(shè)計(jì)內(nèi)容組員main()函數(shù)與數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)*信息錄入函數(shù)與排序函數(shù)*按學(xué)號(hào)排序函數(shù)與按總分排序函數(shù)*查詢(xún)函數(shù)*插入函數(shù)(*顯示函數(shù)與信息刪除函數(shù)*4運(yùn)行及操作說(shuō)明進(jìn)

5、入系統(tǒng):根據(jù)提示從鍵盤(pán)錄入相關(guān)信息: 5、總結(jié)和體會(huì)源程序編輯:編譯:Build:運(yùn)行:輸入:結(jié)果:調(diào)試中遇到的主要問(wèn)題及解決辦法: 在程序的調(diào)試過(guò)程中,常遇到因?yàn)檎`刪或漏寫(xiě)分號(hào),或者字母大小寫(xiě)混亂等造成的語(yǔ)法錯(cuò)誤,以及函數(shù)設(shè)計(jì)不當(dāng)?shù)仍斐傻倪壿嬪e(cuò)誤使程序編譯錯(cuò)誤。由于VC在程序編譯錯(cuò)誤時(shí)的提示信息較為冗雜且很多未能命中關(guān)鍵,因此,仔細(xì)逐行閱讀已有代碼是常用的解決問(wèn)題辦法,有時(shí)也以組員之間交流討論的方式來(lái)尋求解決程序邏輯錯(cuò)誤的方法。收獲和體會(huì):組長(zhǎng):本次C語(yǔ)言綜合設(shè)計(jì),鍛煉了每一個(gè)組員的縝密思考問(wèn)題并解決問(wèn)題的能力,對(duì)個(gè)人的嚴(yán)謹(jǐn)行為習(xí)慣的養(yǎng)成有很大幫助,同時(shí)也使大家在合作中增進(jìn)感情,認(rèn)識(shí)到了團(tuán)隊(duì)

6、合作的重要性與必要性,為今后在團(tuán)隊(duì)中能有更好的表現(xiàn)奠定了基礎(chǔ)。組員:這次綜合設(shè)計(jì)讓我們有了很多提高,克服了不細(xì)心的毛病,這在我們以后的學(xué)習(xí)和工作中有很大的幫助。編程是一項(xiàng)周密細(xì)致的活動(dòng),對(duì)個(gè)人的嚴(yán)謹(jǐn)思考能力有很高的要求,大家的互助合作和個(gè)人的獨(dú)立思考相結(jié)合,讓我們?cè)诮鉀Q設(shè)計(jì)過(guò)程中遇到的問(wèn)題的同時(shí),也提高了自己的思維縝密度,獲益良多。6、程序源代碼/*/#include <stdio.h>#include <stdlib.h>#include <malloc.h>#define LEN sizeof(Student)#define NULL 0typedef

7、struct studentint num;char name20;char sex2;int score3;int sum;struct student *next;Student;int n;Student *cin(void); Student *sort_1(Student *head,int);void sort_2(Student *head);void print(Student *head);Student *sort_all(Student *head);void find(Student *head);Student *add_new(Student *head);/*/S

8、tudent *cin()/*信息錄入函數(shù)*/int flag; Student *head,*p1,*p2;n=0;head=(Student *)malloc(LEN);p2=head;printf("請(qǐng)輸入第【%d】名學(xué)生的相關(guān)信息(學(xué)號(hào)為0結(jié)束輸入):n",n+1);printf("學(xué)號(hào):"); scanf("%d",&flag);while(getchar()!='n');for(;flag;) n+;p1=(Student *)malloc(LEN);p1->num=flag;printf(&

9、quot;姓名:");scanf("%s",p1->name); printf("性別:"); scanf("%s",p1->sex);printf("數(shù)學(xué)成績(jī):");scanf("%d",&p1->score0);printf("英語(yǔ)成績(jī):");scanf("%d",&p1->score1);printf("物理成績(jī):");scanf("%d",&p1-&g

10、t;score2);p1->sum=p1->score0+p1->score1+p1->score2;p2->next=p1;p2=p1;printf("n請(qǐng)輸入第【%d】名學(xué)生的相關(guān)信息(學(xué)號(hào)為0結(jié)束輸入):n",n+1);printf("學(xué)號(hào):");scanf("%d",&flag); p2->next=NULL;printf("nn");return head;/*/Student *sort_all(Student *head) /*排序函數(shù)*/int choos

11、e;for(;) printf("ntt+ + + + +【統(tǒng)計(jì)排序】 + + + + +n");printf("tt|t1.按學(xué)號(hào)排序t |n");printf("tt|t2.按總分排序t |n");printf("tt|t7.單科最高分及平均分 |n");printf("tt|t8.當(dāng)前學(xué)生成績(jī)t |n");printf("tt|t0.返回上一級(jí)菜單 |n");printf("tt+ + + + + + + + + + + + + + + +n");p

12、rintf("請(qǐng)選擇:");scanf("%d",&choose);while(getchar()!='n');switch(choose)case 1:case 2:case 3:case 4:case 5:case 6:head=sort_1(head,choose);break;case 7:print(head);sort_2(head);break;case 8:print(head);break;case 0:return head;default: printf("nn非法值!請(qǐng)重新輸入:nn")

13、;break; /*/Student *sort_1(Student *head,int choose) /*按學(xué)號(hào)排序*/Student *p1,*p2=head->next,*pm,*px;Student mid;if (!p2) return head;for(p1=p2;p1->next!=NULL;p1=p1->next) pm=p1;for(p2=p1->next;p2!=NULL;p2=p2->next)switch (choose)case 1:if (pm->num>p2->num) pm=p2;break; case 2:if

14、 (pm->sum<p2->sum) pm=p2;break; case 3:if (pm->score0<p2->score0) pm=p2;break; case 4:if (pm->score1<p2->score1) pm=p2;break; case 5:if (pm->score2<p2->score2) pm=p2;break;if (pm!=p1)mid=*pm;*pm=*p1;*p1=mid;px=pm->next;pm->next=p1->next;p1->next=px; pr

15、intf("n排序后的成績(jī)表為:n");print(head); return head;/*/void sort_2(Student *head) /*按總分排序*/Student *p=head->next;int max_1,max_2,max_3,min_1,min_2,min_3;int max_sum,min_sum;int sum_1=0,sum_2=0,sum_3=0;float aver_1,aver_2,aver_3,aver_sum;if (!p) return;max_1=min_1=p->score0;max_2=min_2=p->

16、;score1;max_3=min_3=p->score2;max_sum=min_sum=p->sum;for(;p;p=p->next) if (max_1<p->score0) max_1=p->score0;else if (min_1>p->score0) min_1=p->score0;if (max_2<p->score1) max_2=p->score1;else if (min_2>p->score1) min_2=p->score1;if (max_3<p->score2)

17、 max_3=p->score2;else if (min_3>p->score2) min_3=p->score2;if (max_sum<p->sum) max_sum=p->sum;else if (min_sum>p->sum) min_sum=p->sum; sum_1+=p->score0;sum_2+=p->score1;sum_3+=p->score2; aver_1=1.0*sum_1/n;aver_2=1.0*sum_2/n;aver_3=1.0*sum_3/n;aver_sum=aver_1+a

18、ver_2+aver_3;printf("共【%d】名學(xué)生n",n); printf("總分最高分為【%d】,最低分為【%d】,平均分為【%.2f】n",max_sum,min_sum,aver_sum); /*/void find(Student *head) /*查詢(xún)函數(shù)*/Student *p;int choose,fnum;char tem20;if (n=0)printf("n數(shù)據(jù)為空!n ");return;for(;) printf("n選擇查詢(xún)方式:nn");printf("1.按學(xué)號(hào);2

19、.按姓名;0.不查詢(xún)nn");printf("請(qǐng)選擇:");scanf("%d",&choose);while(getchar()!='n');if (choose=1) printf("n請(qǐng)輸入學(xué)號(hào)(輸入0結(jié)束查詢(xún)):");scanf("%d",&fnum);for(;fnum;)for(p=head->next;p!=NULL&&p->num!=fnum;p=p->next);if (!p) printf("nn無(wú)法查詢(xún),請(qǐng)重

20、新輸入(輸入0結(jié)束查詢(xún)):");scanf("%d",&fnum);else if (p->num=fnum)printf("%d:n",p->num);printf("學(xué)號(hào)t姓名t性別t 數(shù)學(xué)成績(jī) 英語(yǔ)成績(jī) 物理成績(jī) 總分n");printf("%dt%st%st %d %d %d %dn",p->num,p->name,p->sex ,p->score0,p->score1,p->score2,p->sum);printf("nn

21、請(qǐng)輸入學(xué)號(hào)(輸入0結(jié)束查詢(xún)):");scanf("%d",&fnum); else if (choose=2)printf("n請(qǐng)輸入姓名(輸入0結(jié)束查詢(xún)):");scanf("%s",tem); for(;strcmp(tem,"0");)for(p=head->next;p!=NULL&&strcmp(p->name,tem);p=p->next);if (!p)printf("nn無(wú)法查詢(xún),請(qǐng)重新輸入(輸入0結(jié)束查詢(xún)):");scanf(

22、"%s",tem);else if (!strcmp(p->name,tem)printf("n%s:n",p->name);printf("學(xué)號(hào)t姓名t性別t 數(shù)學(xué)成績(jī) 英語(yǔ)成績(jī) 物理成績(jī) 總分n");printf("%dt%st%st %d %d %d %dn",p->num,p->name,p->sex ,p->score0,p->score1,p->score2,p->sum);printf("nn請(qǐng)輸入姓名(輸入0結(jié)束查詢(xún)):");

23、scanf("%s",tem);else if (choose=0)printf("n不查詢(xún)!n");break;elseprintf("n其他選擇,視作不查詢(xún)!n");break; /*/Student *add_new(Student *head) /*插入函數(shù)*/Student *p;int flag; printf("nn請(qǐng)輸入新加入學(xué)生的相關(guān)信息(學(xué)號(hào)為0表示結(jié)束輸入):n");printf("學(xué)號(hào):");scanf("%d",&flag);while(ge

24、tchar()!='n');for(;flag;) p=(Student *)malloc(LEN);p->num=flag;printf("姓名:");scanf("%s",p->name); printf("性別:"); scanf("%s",p->sex);printf("數(shù)學(xué)成績(jī):");scanf("%d",&p->score0);printf("英語(yǔ)成績(jī):");scanf("%d"

25、;,&p->score1);printf("物理成績(jī):");scanf("%d",&p->score2);p->sum=p->score0+p->score1+p->score2;p->next=head->next;head->next=p;n+;printf("n請(qǐng)輸入新加入學(xué)生的相關(guān)信息(學(xué)號(hào)為0表示結(jié)束輸入):n");printf("學(xué)號(hào):");scanf("%d",&flag); head=sort_1(he

26、ad,1);printf("加入后的成績(jī)表為:n");print(head); return head;/*/void print(Student *head)/*顯示函數(shù)*/Student *p=head->next;if (!p)printf("nntt+ + + + + 數(shù)據(jù)為空!+ + + + + +nnn");return;printf("共有【%d】名學(xué)生:n",n); printf("+ + + + + + + + + + + + + + + 成績(jī)統(tǒng)計(jì) + + + + + + + + + + + + +

27、+ + + +n");printf("學(xué)號(hào)t姓名t性別t 數(shù)學(xué) 英語(yǔ) 物理 總分n");for(;p;p=p->next)printf("%dt%st%st %d %d %d %dn",p->num,p->name,p->sex ,p->score0,p->score1,p->score2,p->sum=p->score0+p->score1+p->score2); /*/struct student *del(struct student *head,long num) /*信

28、息刪除函數(shù)*/struct student *p1,*p2;if(head=NULL)printf("數(shù)據(jù)為空! n");return head;p1=head;while(num!=p1->num && p1->next!=NULL)p2=p1;p1=p1->next;if(num=p1->num)if(p1=head)head=p1->next;else p2->next=p1->next;printf("已刪除:%ldn",num);n=n-1;else printf("未找到:%ldn",num);return(head);/*/int main()/*主函數(shù)*/Student *head;int choose,i,num;head=(Student *)malloc(LEN);head->next=NULL; for(;) printf("nnnnnn tt+ + + + + + + + + + + + + + + +n");printf(" tt|t1.錄入信息t |n");printf(" tt|t2.統(tǒng)計(jì)排序t |n"

溫馨提示

  • 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)論