C語言課程設計報告 運動會分數(shù)統(tǒng)計系統(tǒng)

上傳人:dao****ing 文檔編號:79338175 上傳時間:2022-04-23 格式:DOC 頁數(shù):24 大小:243.50KB
收藏 版權申訴 舉報 下載
C語言課程設計報告 運動會分數(shù)統(tǒng)計系統(tǒng)_第1頁
第1頁 / 共24頁
C語言課程設計報告 運動會分數(shù)統(tǒng)計系統(tǒng)_第2頁
第2頁 / 共24頁
C語言課程設計報告 運動會分數(shù)統(tǒng)計系統(tǒng)_第3頁
第3頁 / 共24頁

下載文檔到電腦,查找使用更方便

16 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《C語言課程設計報告 運動會分數(shù)統(tǒng)計系統(tǒng)》由會員分享,可在線閱讀,更多相關《C語言課程設計報告 運動會分數(shù)統(tǒng)計系統(tǒng)(24頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、學校:東北大學秦皇島分校班級:50809班姓名:石行學號:5080906C語言課程設計報告運動會分數(shù)統(tǒng)計系統(tǒng)一.需求分析1問題描述運動會分數(shù)統(tǒng)計系統(tǒng)參加運動會有n個系,系編號為1n。比賽分成m個男子項目,和w個女子項目。項目編號為男子1m,女子m+1m+w。不同的項目取前五名或前三名積分;取前五名的積分分別為:7、5、3、2、1,前三名的積分分別為:5、3、2;哪些取前五名或前三名由學生自己設定。(m=20,n=20)2.基本要求:(1). 運動員檢錄;(2)運動員檢錄,(3)運動員成績排序;(4). 運動員評獎3.測試數(shù)據(jù)1輸入:1進入添加系的界面,根據(jù)提示,再輸入:汽車系。再輸入:8,成功

2、添加了一個系。再輸入:2進入運動項目添加界面,根據(jù)提示,再輸入:跳高;1;0;1;2;3。之后輸入0。再次進入系統(tǒng)界面。2輸入:3查看輸出結果。3:輸入:4查看輸出結果。4:輸入:5查看輸出結果。5:輸入:6查看輸出結果。6:輸入:7根據(jù)提示輸入項目編號:2。查看輸出結果。7:輸入:8根據(jù)提示輸入系編號:3。查看輸出結果。二、概要設計 1.數(shù)據(jù)結構系:名稱,編號,男子團體總分,女子固體總分。運動項目: 項目編號,名稱,男子項目,女子項目,前三名,前五名,第一名系的編號,第二名系的編號,第三名系的編號,第四名系的編號,第五名系的編號。2.程序模塊及之間的調(diào)用關系 三、詳細設計 1、數(shù)據(jù)類型定義

3、(1)系的定義:typedef struct Department /系的結構 char name20; /系的名稱 int number; /系的編號 int boy; /男子團體總分 int girl; /女子團體總分 Department *next; Department;(2)運動項目定義:typedef struct Sport /運動項目結構 char name20; /運動項目名稱 int isboy; /0為女項目,1為男項目 int is3; /0為取前五名,1為取前五名 int number; /項目編號 int first; /第一名系的編號 int second; /

4、第二名系的編號 int third; /第三名系的編號 int fourth; /第四名系的編號 int fifth; /第五名系的編號 Sport *next;Sport;、2、函數(shù)之間的調(diào)用關系(1) 系調(diào)用圖 department_add department_Order Department department_search department_addmark department_show department_isexist department_output department_read department_write department_getlong sport_i

5、sexist sport_add sport_getlong sport_writeSport sport_read sport_output sport_search3、算法設計 主要算法的設計思想: 本程序主要是使用鏈表來實現(xiàn)操作。一個運動會包括運動項目和參加運動會的成員。因此構造兩個鏈表Department,Sport。為了操作的方便,并且能夠保存輸入數(shù)據(jù),所以通過文件操作來實現(xiàn)數(shù)據(jù)的寫和讀。每次添加新的數(shù)據(jù)后都要輸入0退出,數(shù)據(jù)才能保存。對于總分的排序使用了冒泡排序。為了使整個程序看起來更加友好,又添加了程序啟動畫面。四、 調(diào)試分析 本程序相對來說比較容易看明白,其中涉及到的一些函數(shù)相

6、對來說比較容易。通過調(diào)試,運行,基本上達到了要求,但還存在一些缺點。如:不夠人性化等。五、 測試結果 多組數(shù)據(jù)輸入與輸出: (1)輸入:3輸出:系名 編號 男團總分 女團總分 總分 法律系 6 0 0 0 電子系 5 3 2 5 數(shù)學系 4 6 0 6 歷史系 3 9 7 16 中文系 2 15 11 26 計算機系 1 21 11 32 旅游系 7 0 7 7(2)輸入:4輸出: 系名 編號 男團總分 女團總分 總分 法律系 6 0 0 0 電子系 5 3 2 5 數(shù)學系 4 6 0 6旅游系 7 0 7 7 歷史系 3 9 7 16 中文系 2 15 11 26 計算機系 1 21 11

7、32(3)輸入:5輸出:法律系 6 0 0 0 電子系 5 3 2 5 數(shù)學系 4 6 0 6 旅游系 7 0 7 7 歷史系 3 9 7 16 中文系 2 15 11 26 計算機系 1 21 11 32 (4)輸入:6 輸出:法律系 6 0 0 0 電子系 5 3 2 5 數(shù)學系 4 6 0 6旅游系 7 0 7 7 歷史系 3 9 7 16 中文系 2 15 11 26 計算機系 1 21 11 32 (5)輸入:7 輸出:請輸入項目編號: 輸入:1回車 輸出: 項目名:100m 項目類型:女子項目 第一名:計算機系 第二名:中文系 第三名:法律系 第四名:無 第五名:無 (6)輸入:8

8、 輸出:請輸入系的編號: 再輸入2 則輸出: 系名:中文系 男子團體總分:3 女子團體部分:10 總分:13 (7)輸入:0 退出六、 用戶手冊 1、運行環(huán)境 Windows,VC+6.0 2、用戶界面 4、操作過程 (1)用戶進入程序啟動界面,等load完成后進入主菜單.主菜單有以下9個選項 1.輸入系別 2.輸入運動項目 3.按系別編號輸出總分 4.按總分排序 5.按男團體總分排序 6.按女團體總分排序 7.按項目編號查詢 8.按系別編號查詢 0.退出 (2)輸入08中的一個數(shù) (3)輸入1,進行添加系操作,分別輸入系的名稱和編號 (4)輸入2,進行添加運動項目操作,分別輸入項目名稱,編號

9、,項目類型,名次選 取,排名情況 (5)輸入0,則退出系統(tǒng),并且保存輸入的信息.每次添加完都要輸入0退出系統(tǒng) 才有效 (6)輸入3,輸出按系編號總分排名. (7)輸入4,輸出按總分排名 (8)輸入5,輸出按男團體總分排序 (9)輸入6,輸出按女團體總分排序 (10)輸入7,進入按項目編號查詢界面.輸入要查詢的項目編號 (11)輸入8,進入按系別編號查詢界面,輸入要查詢的系的編號 七、 參考文獻【1】C+程序設計作者:鄭莉,董淵,張瑞豐 出版社:清華大學出版社 時間:2003/12【2】數(shù)據(jù)結構作者:嚴蔚敏,吳偉民 出版社:清華大學出版社 時間:2006/10【3】數(shù)據(jù)結構教程上機實驗指導作者:

10、嚴蔚敏,吳偉民,米寧 出版社:清華大學出版 社 時間:2006/5【4】 網(wǎng)址: 八、 附錄 1、源程序 #include#include#include#include#include#include#include#includetypedef struct Department /系的結構 char name20; /系的名稱 int number; /系的編號 int boy; /男子團體總分 int girl; /女子團體總分 Department *next; Department;typedef struct Sport /運動項目結構 char name20; /運動項目名稱

11、int isboy; /0為女項目,1為男項目 int is3; /0為取前五名,1為取前五名 int number; /項目編號 int first; /第一名系的編號 int second; /第二名系的編號 int third; /第三名系的編號 int fourth; /第四名系的編號 int fifth; /第五名系的編號 Sport *next;Sport;int getint(int a) /字符轉(zhuǎn)換成數(shù)字 return (int)(a-0);Department * head1;/-啟動畫面函數(shù)-void Cover() system(color 1b); char line=

12、程序讀取中請耐心等待.; char bar=.; int i,j,k=0,x=0,y=0; for(i=0;i=strlen(line)/2;) system(cls); for(j=0;j9;j+) /改變行坐標 coutendl; for(j=0;j(75-strlen(line)/2;j+) /改變列坐標 cout ; for(j=1;j=i;j+) /進度顯示器 couti;x-) cout; if(k=4) i+; coutendl; for(j=0;j(75-strlen(line)/2;j+) /行坐標定位 cout ; coutline; /輸出線條 coutendl; for

13、(j=0;j(65-strlen(bar)/2;j+) cout ; cout(i+7)*5% Loading; cout.write(bar,k); coutendl; for(j=0;j10;j+) coutendl; for(j=0;j24;j+) cout ; cout程序設計員5080906 石行endl; for(j=0;j24;j+) cout ; for(j=0;j=18;j+) cout; coutendl; for(j=0;j4) k=0; void department_add() /添加系 Department * p; int mark=0; p=new Depart

14、ment; coutp-name; char c; while (mark!=1) coutc; if (!isdigit(c)/是否為數(shù)字 cout數(shù)據(jù)非法number=c; p-boy=0; p-girl=0; p-next=head1-next; head1-next=p; cout成功添加了一個系next!=NULL) i+; first=first-next; return i;void department_write()/將系數(shù)據(jù)寫入文本 Department * p; p=head1; p=p-next; ofstream outfile(Department.txt,ios:

15、out); outfiledepartment_getlong(p)+1 ; while (p!=NULL) outfilename number boy girlnext; outfile.close(); coutWrite Success!i; while(i0) Department * p; p=new Department; infilep-namep-numberp-boyp-girl; p-next=head1-next; head1-next=p; i-; coutDepartment Data Read Success!endl;void department_output

16、(Department *p)/輸出系 cout系名編號男團總分女團總分總分tn; while(p) coutname tnumber)tboytgirlt girl+p-boy)next; int department_isexist(int a)/檢驗系是否存在 int b=0; Department *p; p=head1; p=p-next; while(p) if(p-number=a) return 1; p=p-next; return 0;void department_show(int a)/輸出所有系 Department *p; p=head1; p=p-next; wh

17、ile(p) if(p-number=a) coutnamenext; coutnext; while(p) if(p-number=a) cout系名:name男子團體總分:boy女子團體總分:girl總分:boy+p-girl)next; coutnext; while(p) if(p-number=b) if(c=1) p-boy=p-boy+a; else p-girl=p-girl+a; p=p-next; void department_order(Department *temp,int type) /type=0按總分,type=1按男總分,type=2按女總分, Depart

18、ment *p,*q,*small,*temp1; temp1=new Department; temp1-next=NULL; p=temp; while(p) small=p; q=p-next; while(q) switch(type) case 0: if(q-boy+q-girl)girl+small-boy) small=q; break; case 1: if(q-boyboy) small=q; break; case 2: if(q-girlgirl) small=q; break; default: couterrorboy=p-boy; p-boy=small-boy;

19、 small-boy=temp1-boy; temp1-girl=p-girl; p-girl=small-girl; small-girl=temp1-girl; strcpy(temp1-name,p-name); strcpy(p-name,small-name); strcpy(small-name,temp1-name); temp1-number=p-number; p-number=small-number; small-number=temp1-number; /將系的名字互換 q=q-next; p=p-next; Sport * head2;int sport_isexis

20、t(int a) /檢查運動項目(編號)是否已經(jīng)存在 int b=0; Sport *p; p=head2; p=p-next; while(p) if(p-number=a) return 1; p=p-next; return 0;void sport_add() /添加項目 Sport * p; int mark=0; p=new Sport; coutp-name; char c; while (mark!=1) coutc; if (!isdigit(c) cout數(shù)據(jù)非法endl; else if(sport_isexist(c) cout該編號已存在number=c; mark=

21、0; while (mark!=1) coutc; p-isboy=(int)(c-0);/字符轉(zhuǎn)換成數(shù)字 if (!isdigit(c) cout數(shù)據(jù)非法isboyisboy1) cout數(shù)據(jù)非法isboy=c; mark=0; while (mark!=1) coutc; p-is3=(int)(c-0); if (!isdigit(c) cout數(shù)據(jù)非法is3is31) cout數(shù)據(jù)非法is3=c; mark=0; while (mark!=1) coutc; if (!isdigit(c) cout數(shù)據(jù)非法endl; else if(!department_isexist(c) cou

22、tfirst=c; if(p-is3=0) department_addmark(5,c,p-isboy); else department_addmark(7,c,p-isboy); mark=0; while (mark!=1) coutc; if (!isdigit(c) cout數(shù)據(jù)非法endl; else if(!department_isexist(c) coutsecond=c; if(p-is3=0) department_addmark(3,c,p-isboy); else department_addmark(5,c,p-isboy); mark=0; while (mar

23、k!=1) coutc; if (!isdigit(c) cout數(shù)據(jù)非法endl; else if(!department_isexist(c) coutthird=c; if(p-is3=0) department_addmark(2,c,p-isboy); else department_addmark(3,c,p-isboy); mark=0; if(p-is3=1) while (mark!=1) coutc; if (!isdigit(c) cout數(shù)據(jù)非法endl; else if(!department_isexist(c) coutfourth=c; department_a

24、ddmark(2,c,p-isboy); mark=0; while (mark!=1) coutc; if (!isdigit(c) cout數(shù)據(jù)非法endl; else if(!department_isexist(c) cout該系不存在,請先添加fifth=c; department_addmark(1,c,p-isboy); else p-fourth=0; p-fifth=0; p-next=head2-next; head2-next=p; cout成功添加了一個運動項目next!=NULL) i+; first=first-next; return i;void sport_w

25、rite() /將項目數(shù)據(jù)寫入文本文檔 Sport * p; p=head2; p=p-next; ofstream outfile(Sport.txt,ios:out); outfilesport_getlong(p)+1 ; while (p!=NULL) outfilename number isboy is3 first second third fourth fifthnext; outfile.close(); coutWrite Success!i; while(i0) Sport * p; p=new Sport; infilep-namep-numberp-isboyp-is

26、3p-firstp-secondp-thirdp-fourthp-fifth; p-next=head2-next; head2-next=p; i-; coutSport Data Read Success!endl;void sport_output(Sport *p) /輸出項目的情況 coutname tNum B/G 3/5 first second third fourth fifth endl; while(p) coutname t number) isboy) is3) first); department_show(p-second); department_show(p-

27、third); department_show(p-fourth); department_show(p-fifth);/printf(n); p=p-next;coutn; coutnext; while(p) if(p-number=a) cout項目名:nameendlisboy=1) cout男子項目; else cout女子項目; coutendlfirst); coutendlsecond); coutendlthird); coutendlfourth); coutendlfifth); return; p=p-next; coutnext=NULL; head2=new Spo

28、rt; head2-next=NULL; /school_add(); sport_read(); department_read(); /sport_add(); Department * p1; Sport * p2; p1=head1; p1=p1-next; p2=head2; p2=p2-next; char choose; char temp; /string ch= ; int a=1; while(a!=0) coutendl; cout .oO歡迎使用運動會分數(shù)統(tǒng)計系統(tǒng)Oo.endl; cout *endl; cout * *endl; cout * 1.輸入系別; 2.輸入運動項目 *endl; cout * *endl; cout * 3.按系別編號輸出總分; 4.按總分排序; *endl; cout * *endl; cout * 5.按男團體總分排序; 6.按女團體總分排序; *endl; cout * *endl; cout * 7.按項目編號查詢; 8.按系別編號查詢; *endl; cout * *endl; cout * 0.退出

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

相關資源

更多
正為您匹配相似的精品文檔
關于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!