C語言-校際運動會管理系統(tǒng)_第1頁
C語言-校際運動會管理系統(tǒng)_第2頁
C語言-校際運動會管理系統(tǒng)_第3頁
C語言-校際運動會管理系統(tǒng)_第4頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、“校際運動會 管理系統(tǒng)一題目要求設(shè)計校際運動會管理系統(tǒng),實現(xiàn)學(xué)校、運動員信息和運動項目的錄入,比賽結(jié)果的輸入,各個學(xué)校比賽結(jié)果的查詢,生成團體總分報表,查看參賽學(xué)校信息和比賽項目信息。要求功能選擇用菜單實現(xiàn)。二 需求分析根據(jù)題目要求應(yīng)提供鍵盤式菜單實現(xiàn)功能選擇,還應(yīng)提供信息的輸入操作,由于在程序中提供查詢功能所以應(yīng)有顯示、查找等操作。一、總體設(shè)計根據(jù)上面的需求分析,可以將這個系統(tǒng)的設(shè)計分為入模塊 3 、查詢模塊。具體校際運動會管理系統(tǒng)分為校各個項目的得分的查尋、總體報表的生成。1、信息輸入模塊2 、比賽結(jié)果錄信息的輸入、結(jié)果的輸入、學(xué)二、詳細設(shè)計1、 主函數(shù)主函數(shù)一般設(shè)計的比較簡潔,只提供輸入

2、,處理和輸出部分的函數(shù)調(diào)用。其中功能模塊用菜單方式選擇。流程圖程序main()menu();/*menu是菜單函數(shù) */菜單函數(shù)程序如下:menu() int o,n; do puts(tt*MENU*);puts(nntt1.The information to writeinn);puts(tt2.The race result records to writeinn);puts(tt3.Search the informationn);puts(tt4.Exitn);puts(ntt*);puts(nnChoice you number:);scanf(%d,&n);if(n4)o=1;

3、getchar();/*對選擇的數(shù)字進行判斷*/else o=0;while(o=1);/*選擇功能 */switch(n) case 1:writein();break;/*信息輸入模塊*/case 2:resultin();break;/*比賽結(jié)果輸入模塊*/case 3:search();break;/*查詢模塊 */case 4:exit(0);/*退出 */各個模塊的設(shè)計1、 信息輸入數(shù)據(jù)結(jié)構(gòu) 數(shù)據(jù)結(jié)構(gòu)采用結(jié)構(gòu)體的形式,包括學(xué)校、項目、運動員三個結(jié)構(gòu)體。比如學(xué)校結(jié)構(gòu)體成員包括學(xué)校校名、競賽項目、得分;項目結(jié)構(gòu)體成員包括項目名、權(quán)值。struct student char shool1

4、0; char name10; char item10; char sex;int position;int mark;stuC;/*stuN中每個數(shù)組元素對應(yīng)一個學(xué)生*/struct item char name10;char sex;int mark;itC;/*itC中每個數(shù)組元素對應(yīng)一個項目*/struct shool char name10; char item10; int mark;shoC/* shoC每個數(shù)組元素對應(yīng)一個學(xué)校;*/ 信息輸入模塊根據(jù)題意把與運動員的學(xué)校、名字、項目、性別、名次、分數(shù)作為結(jié)構(gòu)體成員,如果要存放若干個運動員的信息就用結(jié)構(gòu)體數(shù)組。struct stu

5、dent char shool10; char name10;char item10;char sex;int position;int mark;stuC;/*stuC中每個數(shù)組元素對應(yīng)一個運動員*/stuC中的 C 為運動員的個數(shù),程序中采用宏定義的方式定義C=100,C 的值可隨時在源程序中改變。輸入運動員的學(xué)校、名字、項目、 性別輸入運動員的名次并進入選擇模式if(t=2)返回主函數(shù)圖 2 輸入模塊流程圖/*輸入模塊 */writein()/*輸入模塊 */ int t,r,i=0;extern j;char F,M;y=1;printf(nPleasewriteinthestuden

6、tsname:t);scanf(%s,&);/* 輸入名字 */printf(nPlease writein the students shool:t);scanf(%s,&stui.shool);/* 輸入學(xué)校 */printf(nPleasewriteinthestudentsitem:t);scanf(%s,&stui.item);/* 輸入項目 */loop_1:printf(nPleasewriteinthestudentssex(WorM):t);scanf(%s,&stui.sex); /*輸入性別 */if(stui.sex!=W&stui.sex!=M)go

7、to loop_1;/*選擇函數(shù) */printf(nPleasewriteinthestudentsposition:t);scanf(%d,&stui.position);mark(j,i);loop_2:printf(nnDo again?t1).Yest2).Not);scanf(%d,&t);if(t!=2&t!=1)goto loop_2;/*調(diào)用 goto 結(jié)構(gòu) */if(t=2)menu();i+;if(t=1);f=1;printf(Success!nPress any key+enter to menu.);scanf(%d,&r); /*返回主函數(shù)*/menu(); 結(jié)果

8、錄入模塊該模塊的功能是輸入男女運動員的成績,并由用戶選擇或定義各名次的分數(shù)。流程圖提醒用戶先輸入運動員信息輸入學(xué)校的代號、男女運動項目的代號用戶選擇或定義各名次的分數(shù)輸入成績并反回主函數(shù)程序/*結(jié)果錄入模塊*/resultin()/*結(jié)果錄入模塊*/ int h,r; extern N,M,W,y; if(y=0) printf(Please establish system first!nPress any key +enter to menu. );scanf(%d,&r);/*提醒用戶輸入運動員的基本信息menu();*/printf(nThe number of shool atten

9、ded is:);scanf(%d,&N);printf(nThe number of men item is:);scanf(%d,&M);printf(nThe number of women item is:);scanf(%d,&W);/*輸入學(xué)校的代號、男女運動項目的代號printf(nThere are three form of marked you can choice:);printf(nnt1).1th-7,2th-5,3th-3,4th-2,5th-1.);printf(nnt2).1th-5,2th-3,3th-1.);printf(nnt3).Define by yo

10、uself.);/*用戶自定義 */*/loop: printf(nnChoice the number(1-3):);scanf(%d,&h);if(h0&h4|e1)goto loop;printf(Press any key+enter to menu.);scanf(%s,&c);menu();search_school()/*學(xué)校查詢程序*/ int x,sum=0,w=0;struct student s;printf(nPlease enter the name of the school that you want to search:); scanf(%s,&s.shool)

11、;printf_face(); for(x=0;xC;x+)if(strcmp(s.shool,stux.shool)=0) /*調(diào)用 stu 結(jié)構(gòu)體 */ sum+=stux.mark; printf_one(x);w=1;/*讀出結(jié)構(gòu)體的數(shù)據(jù)*/printf_sum(sum);if(w=0)printf(nn*The name is wrong,press again!);search_school();search_item()/*項目查詢程序 */ int x,sum=0,w=0;struct student s;printf(nPlease enter the name of the

12、 item that you want to search:); scanf(%s,&s.item);printf_face();/*for(x=0;xC;x+)if(strcmp(s.item,stux.item)=0)/ *數(shù)據(jù)輸入調(diào)用*/stu 數(shù)組 */ sum+=stux.mark; printf_one(x);w=1;printf_sum(sum);/*數(shù)據(jù)輸出*/if(w=0) printf(nn*The name is wrong,press again!);search_item(); 程序中調(diào)用的函數(shù)記分的函數(shù)即用來確定不同的名次所得的不同分數(shù)。mark(int j,int

13、 i) int g; extern p15,q15; if(j=1)if(stui.position=1)stui.mark=7; else if(stui.position=2)stui.mark=5; else if(stui.position=3)stui.mark=3; else if(stui.position=4)stui.mark=2; else if(stui.position=5)stui.mark=1;if(j=2) if(stui.position=1)stui.mark=5; else if(stui.position=2)stui.mark=3;else if(stu

14、i.position=3)stui.mark=1;if(j=3) for(g=0;g15;g+)if(stui.position=pg)stui.mark=qg;define_mark()/*自定義名次分數(shù)的子函數(shù)*/ static int p15,q15,a,b,j; for(a=0;a15;a+) printf(nThe position(1-15):);scanf(%d,&pa);printf(nThe mark you want to define(Integral):);scanf(%d,&qa);/*自定義*/loop:printf(nDo you want define more:t1).Yest2).No);scanf(%d,&b);if(b=2)break;if(b!=1)goto loop;j=3;printf_one(int x)/*運動員個人信息的輸出函數(shù)*/ printf(n%-20s%-20s%-20s%-5c%-9d%-5d,stux.shool,,stux.item, stux.sex,stux.position,stux.mark);printf_sum(int su

溫馨提示

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

評論

0/150

提交評論