c语言程序设计用高级语言实现篮球联赛个人技术数据处理系统[技巧]_第1页
c语言程序设计用高级语言实现篮球联赛个人技术数据处理系统[技巧]_第2页
c语言程序设计用高级语言实现篮球联赛个人技术数据处理系统[技巧]_第3页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、l=il=iC语言程序设计用高级语言实现篮球联赛个人技术数据处理系统技巧题口:篮球赛个人技术统讣系统设某篮球联赛要统讣20名著名球员个人技术数据。要求用高级语言实现篮球联赛个人技术数据处理系统。该系统在磁盘上存储如下信息:1。每场球赛的个人 技术数据。一场球一个人的技术数据包括:姓名,所属球队,三分球个数,篮板球 个数,扣篮成功次数,抢断次数,得分,比赛日期。个人技术数据汇总表。表 中反映了每个人的技术数据的累计结果。表羡为:姓名,三分2球总数,篮板球总数,扣篮成功总次数,抢断总次数,得分总数,比赛场数。 本系统功能如下:1。创建存储每常球赛个人技术数据的存储系统(笫一次输入个人技术数据时),

2、然后自动创建存储个人技术数据汇总表的存储系统。2。每场比赛后,添加 个人技术数据,然后自动修改个人技术数据汇总表3。能输出当前的个人技术数据汇总表4o能输出指定技术项LI平均每场数据 较高的前三名运动员的姓名,所在队名和平均每场的单项数据。程序:/* Basketball Statistic Information System* Write By: Yan Yi Ling;* Date: 2008-09-10*/#define MAX_PLAYER 100#define P3 0#define SD 1#define RB 2#define CT 3#define CO 4iidefine

3、MAX.TOP 3#define false 0#define true 1struct basketball char name20: /* char team20: /* short point_3; /* short rebound; /* short sd; /* slam player s name */ player s team */ three pointer */ rebound */dunk */short cut; /* cut */ short course; /* couese */ char dateEllJ: /* race date */ playerMAX_P

4、LAYER;substr(char *p_from, char *p_to, int pstart, int p_len) int index = 0, stop = p_start + p_len; while(p_start < stop) p_toindex+ = p_fromZp_start+:p_tolindex = ' 0'str2int(char *p_str) int res = 0, index, len;for(index = 0, len = strlen(p_str); index if(p_strindex < 'O' p_

5、strindex! > ' res = res * 10 + (int)pstrindex - 48;return res;split(char *p_str, char p_chr) int index;for (index = 0; p_str index != p_chr && p.+index) /* do nothing here */return index;include "stdio. h"#include "conio. h"short playerlen = 0; /* how many players

6、main()short op_type, op_ski11;char tmp20;loadinfo ();< len; index+) ')continue;strindex != ' 0 ;in the system currentwhile (1) showMenu ();scanf, &op_type);switch(op_type) case 1:inputPlayerlnfo();break;case 2:printf(,?Please input player's name: “);scanftmp);displayPlayerlnfo (tm

7、p);break;case 3:displayPlayerlnfo ;break;case 4:printf(,zPlease input player's name: ”); scanf(s, tmp);displayPlayerCount (tmp);break;case 5:printf (z/%dthree pointn,z, P3);printf (z/%dslam dunkn,z, SD);printf C%dreboundn,z, RB);printf(,z%d => course'n", CO);puts(Z/Please choose one

8、of the skill you want to order: ”); scanf (/%d,/, &op_skill);d i sp1ayTopInfo (op_sk i11);break;case 6:puts(Z/Thank you to use this system!,z):puts(Bye!);return;default:puts (/zInput error! You must input number between 1 and 3!"); break;printf ("Enter to continue!zz):getchar ();getcha

9、r ();puts (z/nnnnnnnnnnnnnnnn,z);/* show menu and return user s operation*/int showMenu () showTab (3):puts ("Basketball Statistic Information System");showTab(7):putsfWrite By: Yan Yi Ling");puts ("1:Input player information);puts("2:Display player information7');puts(&

10、quot;3:Display all of the player information);puts("4:Display player1 s count information);printf (z/5: Display TOP %d informaionn,z, MAX_TOP);puts("6: Exitn");printf C'Choose one of the function you want: ”); / input and save players information inputPlayerlnfo () 辻(player.len &g

11、t;= MAX_PLAYER) * show tab in the screen* x)aram p_tab: show many tab will print to the screen*/showTab (int p_tab) short index;for(index = 0; index < p_tab; +index)printf Ct');puts(Z/Too many information!,z):return;printf(,zPlease input player's name: ”);scanf(s: playerplayer_len name);p

12、rintf (''Please input players' team: ”);scanfplayerplayer_len team);printf (''Please input race date (YYYY-MM-DD): “);scanfplayerplayer_len date);getchar (); /* forcus enter */printf(,zHow many three pointer did he/she got: ”);scanf&playerplayer_len point_3);printf(,zHow many

13、 rebound did he/she got: “);scanf&playerplayer_len rebound); printf("How many slam dunk did he/she got: ”);scanf (z/%d,z, &player Eplayer_len sd);printf("How many cut did he/she got: ”); scanf&playerplayer_len cut);printf("Howmany course did he/she got:scanf&p1ayerp1ay

14、er_len course);+player_len;if ( saveinfo ()putsCsave information success!,z) ; * display players informaion according to player,s name*/displayPlayerInfo (char save palyer,zs information into file*/p_name) short index, flag = false;printf (,zThere are %d records in the system. n,z, player_len):puts

15、(,zNametTeamtDatet3 PointertSlamDunktReboundtCuttCoursetz/);for(index = 0; index < player_len; index+) if( !strcmp(p_name, ) II = p_name)flag = true;printf (z,%st%st%stt,z, player index name, player index team,playerindex date);printf (,z%dt%dtt%dt%dt%dnn,z, player index. point_3,

16、playerindex sd,playerindex rebound, playerindex cut, playerindex course);if( !flag &&!= p_name) printf (z,Sorry, can not find %s" s information'll", p_name):saveinfo () FILE *fp;short index;if( (fp = fopen("record, txt", "w+") = NULL )puts CCan not save info

17、rmation into your disk, please check you permission!,z);return false;for(index = 0; index < player_len; index+) fprintf (fp, z/%s, %s, %s, %d, %d, %d, %d, %dn,z, player Eindex name, playerindex team,playerindex! date, playerindex point_3, player Eindex sd,playerindex rebound,playerindex cut, play

18、erindex course);return true;/* load player,zs information from file and save into "struct player"*/loadinfo () FILE *fp;char strlOOZ, sub_str20;int indexl, index2;if( (fp = fopen("record.txt", "r")二二 NULL ) puts (zzIt, s look you login this system first time!"); re

19、turn false;while( fgets(str, 100, fp) ) indexl = 0;index2 = split (str + indexl,substr (str, p 1 ay er p 1 ay er_l en .n ame, indexl, index2);indexl +二 index2 + 1:index2 = split(str + indexl,substr(str, playerplayer_len team, indexl, index2);indexl +二 index2 + 1:index2 = split (str + indexl,substr (

20、str, p1ayerp1ayer_len date, indexl, index2);indexl +二 index2 + 1:index2 = split(str + indexl,substr(str, sub_str, indexl, index2):player Lplayer_lenpoint_3 = str2int(sub_str):indexl +二 index2 + 1:index2 = split (str + indexl,substr(str, sub_str, indexl, index2);player Lplayer_len.sd = str2int(sub_st

21、r):indexl +二 index2 + 1:index2 = split (str + indexl, ;);substr (str, sub_str, indexl, index2);playerplayer_lenrebound = str2int(sub_str):indexl +二 index2 + 1:index2 = split(str + indexl,substr(str, sub_str, indexl, index2):player Lplayer_lencut = str2int(sub_str):indexl = index2 + 1:index2 = split

22、(str + indexl, ;);substr (str, sub_str, indexl, index2);player Lplayer_lencourse = str2int(sub_str);indexl = index2 + 1:player_len+;/* Display count information according to player s name*/disp1ayP1ayerCount (char *p_name) int point_3, rebound, sd, cut, course, times, index;point_3 = rebound = sd =

23、cut = course = times = index = 0;for (: index < player_len; +index) if( strcmp(p_name, )continue;point_3 +二 playerindexpoint_3;rebound +二 playerindexrebound;sd +二 playerindexsd;cut +二 playerindexcut;course +二 playerindexcourse;times+;printf (,/%s, s count information: n p_name);pr

24、intf (Z/Three PointertReboundtSlam dunktCuttCoursetRace times'n");printf (,z%dtt%dtt%dt%dt%dt%dn,z, point_3, rebound, sd, course, times);/* Display Top3 information according to skill*/displayTopInfo(short p_skill) int pointsMAX_PLAYER;char nameMAX_PLAYER20;short topMAX_T0P, index, index2,

25、len, tmp;if(player_len = 0) return;for(index = 0; index < MAX_PLAYER: index+) nameindex0 = ' 0 ;/* caculate skill information for each player " » " " " » » " " » " I I I I I I I I I I I for(index = len = 0; index < player_len; index+)

26、for(index2 = 0; index2 < MAX_PLAYER; index2卄) if( !strcmp(nameindex2, ) ) tmp = index2;break;if(index2 = MAX_PLAYER) tmp = len+;strcpy(nametmp, playerindex name);pointsEtmp_ = 0;switch (p_skill) case P3:pointstmpZ +二 playerindexpoint_3;break;case SD:pointstmpZ +二 playerindexsd;bre

27、ak;case RB:pointstmpZ +二 playerindexrebound:break;case CT:pointstmp. +二 playerindexcut;break;default:pointstmp. +二 playerindexcourse;break;: I 1* I 1 I I 1* I 1 I I 1* I 1 I I 1* I 1 I | a | 1 a * j a | a | 1 a * j a | a | 1 a * j a | a | 1 a * j J | 4 j j j | 4 | 4 j j j | 4 | 4 j j j | 4 | 4 j j j

28、 | j for (index = 0; index < MAX_T0P; index+)get top3 recordstopindex = index; I I I I I 1 I I I I I I I 1 I I I I I I I 1 I I I I I 1 I I I I I I I 1 I I I I I I I 1 I I I I I I I for(index =0; index < len; index+) if ( points01 < pointsindex ) for( tmp = MAX_T0P - 1: tmp >0; tmp-) topE

29、tmp = toptmp - 1;top0一 = index;/* display information " » » " » " " » " » » " » " " » " » » " » " " » " » I I I I I I I I I I I I I I I I I I I I I I I I I I for( index =

30、 0; index < len; index+) printf (/ZTOP %d: %sttt%dn,z, index + 1, name top index > pointstop LindexJ);f VIW VIV VIW VIW VIW VIW VIWVIW VIW VIW VIW VIW VIW VIWVIW VIW VIW VIW VIW VBW VIWVIW VIW VIW VIW VIW VBW VIW VIW V " » " " » » " " » " "

31、; » » " " » " " » » " " » " " » » " I j j | j 4 | j j | j 4 | j j | j 4 | j j | j 4 | j 数据测试结果(程序调试结果):1开始输入信息:p«lmrer inf or««t i on ayI nFocMt Aony I o4 the pl/eriony p|«ver» count inloriM

32、l Ion 3 TOP 3 "仏foLMP-PP-AJI2输入队员信息:r-ncxwe one of *hc function vou want; 1 *!««« inpjt plorcr'i ym" tiicsnJroue inpit pia-reri* tcap= 0C町WGU inewt race date( Y/VY KM-t>D > : 8"9-04-25 jos roy t hrec pointer di d heZ?:hc -got : § rlos neny r ebo«jna

33、di d he/she ot: 8 law nsry 9 1cm du-nk did he/»he 9ot i 9 ioc* fiany eut die he/she got: 6Mcxj fianij course did he rah e got: 7i avr J nf ormat Iooj nuccrs$ Enter to cont inuc?3输入完信息后,显示成员信息(需输入程序中已有的成员名,否则出错。):fim ketbal 2 Star nt lc T*/ orMt ton Svst emWn le 9r i El 1 een 1? lri>utiniorHJ

34、tlaNZ- pispley pJaver in*or*9tion3; Dlsply All of !b< <)Leycr irtf ornaCionJ? 0-laplar pJfirfir'ainForrvatlon5<i D i*p|«r I Op 3 irvlorwiaion*53ore of the Iunet «* "QVl 小 ru rc are 11 -ecords inFr PeteLiSHt : 2SIr Csnkc«n not F ind Jlmviy anarrwit ton4显示成员信息(正确输入成员名。

35、):T>u1 ployesr i nForv)dt i onI StatitseSestonUrile ByI wployIicplM bisjdjylb: D ivplay TU! p: Exit1 hT.one off iea->rinput :ITbrrr arc 11NineI earnJ iEFGIto cont7*-8-15tkc fwnGtinn y” wnt; 2 player*» iiuracZ Jmnv rccerd in t hrl4le 3 Po interyer 1Arorotion player inlorndlieB o 11 the player i A-fo<rMA t Jom P layer % caunt iafE4)lioi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论