| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2655 人关注过本帖, 1 人收藏
标题:[原创]c#运动会管理系统
只看楼主 加入收藏
luomingchu
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-4
收藏
得分:0 
下下来学习 谢谢
2007-01-09 00:26
luomingchu
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-12-4
收藏
得分:0 
没有源代码,楼主能不能提供源代码??
2007-01-09 00:29
zouchao
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-12-14
收藏
得分:0 
using System;
using System.Collections;
namespace SportsMeetManageSystem
{
class Sport
{
string name,sex,school,matchltem;
int age,order,score;
public string Name
{
get{return name;}
set{name=value;}
}
public string Sex
{
get{return sex;}
set{sex=value;}
}
public string School
{
get{return school;}
set{school=value;}
}
public string Matchltem
{
get{return matchltem;}
set{matchltem=value;}
}
public int Age
{
get{return age;}
set{age=value;}
}
public int Order
{
get{return order;}
set{order=value;}
}
public int Score
{
get{return score;}
set{score=value;}
}//定义了一个运动学生类,用来存放学生信息。
}
class OrderAndScore
{
public ArrayList order5(ArrayList ArrayLists,string matchs)
{
ArrayList myArrayList=new ArrayList();
for(int i=0;i<ArrayLists.Count;i++)
{
Sport mySport=(Sport)ArrayLists[i];
if(matchs==mySport.Matchltem&&mySport.Order<=5)//判断运动项目相等并且该项目的名次要小于5。
{
switch(mySport.Order)
{
case 1:
mySport.Score=7;
break;
case 2:
mySport.Score=5;
break;
case 3:
mySport.Score=3;
break;
case 4:
mySport.Score=2;
break;
case 5:
mySport.Score=1;
break;
}//给该项目的前5名赋分数
myArrayList.Add(mySport);//加到动态数组中
}
}
return myArrayList;
}
public ArrayList order3(ArrayList ArrayLists,string matchs)
{
int zou=ArrayLists.Count;
ArrayList myArrayList=new ArrayList();
for(int i=0;i<zou;i++)
{
Sport mySport=(Sport)ArrayLists[i];
if(matchs==mySport.Matchltem&&mySport.Order<=3)//判断运动项目相等并且该项目的名次要小于3。
{
switch(mySport.Order)
{
case 1:
mySport.Score=5;
break;
case 2:
mySport.Score=3;
break;
case 3:
mySport.Score=2;
break;
} //给该项目的前3名赋分数
myArrayList.Add(mySport);
}
}
return myArrayList;
}
}
class SportsMee
{
static void Main()
{
try //捕捉异常
{
int N,M,W,i,n,k;string t;
ArrayList athlete=new ArrayList(10);
SportsMee mySportsMee=new SportsMee();
OrderAndScore myorder=new OrderAndScore();
Console.WriteLine("请输入参赛学校的数目:");
N=int.Parse(Console.ReadLine());
Console.WriteLine("请输入男子参赛项目数目:");
M=int.Parse(Console.ReadLine());
Console.WriteLine("请输入女子参赛项目数目:");
W=int.Parse(Console.ReadLine());
string[] school=new string[N];
string[] manmatch=new string[M];
string[] womenmatch=new string[W];
int[] zou=new int[N];//定义一个数组用来存放学校的总分。
string[] match=new string[M+W];
for(i=0;i<M;i++)
match[i]=manmatch[i];
k=M;
for(i=0;i<W;i++)
{
match[k]=womenmatch[i];
k=M+1;
}//把男子和女子项目存放在同一个数组中。
Console.WriteLine("**********请输入参赛学校***************");
for(i=0;i<N;i++)
{
Console.Write("第{0}所学校:\t",i+1);
school[i]=Console.ReadLine();
}//输入参赛学校
Console.WriteLine("**********请输入男子参赛项目***********");
for(i=0;i<M;i++)
{
Console.Write("第{0}项:\t",i+1);
manmatch[i]=Console.ReadLine();
}//输入男子项目
Console.WriteLine("**********请输入女子参赛项目***********");
for(i=0;i<W;i++)
{
Console.Write("第{0}项:\t",i+1);
womenmatch[i]=Console.ReadLine();
}//输入女子项目
Console.WriteLine("请输入参赛运动员的总人数:");
n=int.Parse(Console.ReadLine()); //输入参赛运动员的总人数
Console.WriteLine("下面是输入运动员的信息。");
for(i=0;i<n;i++)
{
Sport mySport=new Sport();
Console.WriteLine("请输入第{0}个运动员的信息:",i+1);
Console.Write("姓名:\t");
mySport.Name=Console.ReadLine();
Console.Write("性别:\t");
mySport.Sex=Console.ReadLine();
Console.Write("年龄:\t");
mySport.Age=int.Parse(Console.ReadLine());
Console.Write("所属院校:\t");
mySport.School=Console.ReadLine();
Console.Write("参赛项目:\t");
mySport.Matchltem=Console.ReadLine();
Console.Write("参加项目的名次:\t");
mySport.Order=int.Parse(Console.ReadLine());
mySport.Score=0;
athlete.Add(mySport);
} //输入每个运动员的信息
for(i=0;i<athlete.Count;i++)
{
Sport mySport=(Sport)athlete[i];
if(mySport.Order==1)
mySport.Score=5;
else if(mySport.Order==2)
mySport.Score=3;
else if(mySport.Order==3)
mySport.Score=2;
} //给每个项目都默认为取其前3名。
do
{
Console.WriteLine("*************************************************************");
Console.WriteLine(" 运动会查询系统 ");
Console.WriteLine("1. 参赛运动员的信息");//输出所有运动员的信息
Console.WriteLine("2. 项目获奖的情况");//用户可以单独的查找一个项目的获奖情况,也可以查看全部的项目获奖信息
Console.WriteLine("3. 学校获奖的情况");//可以输出全部学校的获奖情况包括:学校总成绩,男子总成绩,女子总成绩,也可以查询一个学校的获奖情况。
Console.WriteLine("4. 学校的名次");//根据学校的总成绩排出名次
Console.WriteLine("0. 退出"); //退出该系统
//建立运动会查询系统
Console.Write("请输入要查找的项:\t");
k=int.Parse(Console.ReadLine());
if(k==1)
{
Console.WriteLine("姓名\t性别\t年龄\t所属院校\t参赛项目\t所得名次");
for(i=0;i<athlete.Count;i++)
{
Sport mySport=(Sport)athlete[i];

Console.WriteLine("{0}\t{1}\t{2}\t{3}\t\t{4}\t\t{5}",mySport.Name,mySport.Sex,mySport.Age,mySport.School,mySport.Matchltem,mySport.Order);
}
}//实现查询系统1的功能,输出运动员的信息。
if(k==2)
{
do
{
Console.WriteLine("项目的取名次的方法:1(取前5名),2(取前3名),3(输出所有项目的获奖信息),0(退出)");
Console.WriteLine("提示!(如果不输入系统将按每个项目的前3名排。)"); //建立一个子系统,项目的取名方法有两种,由用户自己定义,也可以不选择,系统将取其每个项目的前3名。
n=int.Parse(Console.ReadLine());
if(n==1)
{
Console.WriteLine("请输入要取名次的项目:");
t=Console.ReadLine();
mySportsMee.shuchu(myorder.order5(athlete,t));//调用order5方法,取项目的前5名。
}
else if(n==2)
{
Console.WriteLine("请输入要取名次的项目:");
t=Console.ReadLine();
mySportsMee.shuchu(myorder.order3(athlete,t));//调用order3方法,取项目的前3名。
}
else if(n==3)
{
for(i=0;i<athlete.Count;i++)
{
Sport mySport=(Sport)athlete[i];
if(mySport.Score!=0)
{
Console.WriteLine("运动项目\t运动员姓名\t性别\t所属院校\t所得分数");
Console.WriteLine("{0}\t\t{1}\t\t{2}\t{3}\t\t{4}",mySport.Matchltem,mySport.Name,mySport.Sex,mySport.School,mySport.Score);
}
}//输出所有项目的获奖信息。
}
}while(n!=0);
}
if(k==3)
{
mySportsMee.school1(athlete,manmatch,womenmatch,school);//调用school1方法实现学校获奖情况的查询。
}
if(k==4)
{
for(int x=0;x<school.Length;x++)
{
n=0;
for(i=0;i<athlete.Count;i++)
{
Sport mySport=(Sport)athlete[i];
if(mySport.School==school[x])
n=n+mySport.Score;
}
zou[x]=n;//统计每个学校的总分,并放到zou数组中。
}
for(i=0;i<school.Length;i++)
for(int j=0;j<school.Length;j++)
{
if(zou[i]>zou[j])
{
n=zou[i];
zou[i]=zou[j];
zou[j]=n;
t=school[i];
school[i]=school[j];
school[j]=t;
}
}//实现对总分的排序。
for(i=0;i<school.Length;i++)
Console.WriteLine("第{0}名是{1}得分为:{2}",i+1,school[i],zou[i]); //按名次输出学校的获奖情况。
}
}while(k!=0); //等于0则退出运动会查询系统。
}
catch(Exception e)
{
Console.WriteLine("-----------------------------------------------------");
Console.WriteLine("以下是异常原因:"+"\n\n"+e.Message+"\n");//输出异常原因
}
}
public void shuchu(ArrayList myArrayList)
{
for(int i=0;i<myArrayList.Count;i++)
{
Sport mySport=(Sport)myArrayList[i];
Console.WriteLine("该项目的排名情况为:");
Console.WriteLine("{0}\t所属学校:{1}\t获奖项目:{2}\t名次为:{3}\t得分:{4}",mySport.Name,mySport.School,mySport.Matchltem,mySport.Order,mySport.Score);
}//实现对动态数组的输出。
}
public void school1(ArrayList athlete,string[] manmatch,string[] womenmatch,string[] school2)
{
int n;
do
{
int k=0,m=0;
string school;
Console.WriteLine("1.(单个学校的获奖情况) 2.(所有学校的获奖的情况) 0.(退出)");//设置3个选项。
n=int.Parse(Console.ReadLine());
if(n==1)
{
Console.Write("请输入所要查询的学校:\t");
school=Console.ReadLine();
for(int i=0;i<athlete.Count;i++)
{
Sport mySport=(Sport)athlete[i];
for(int j=0;j<manmatch.Length;j++)
{
if(school==mySport.School&&manmatch[j]==mySport.Matchltem)
k=mySport.Score+k;//男子运动员的成绩
}
for(int j=0;j<womenmatch.Length;j++)
{
if(school==mySport.School&&womenmatch[j]==mySport.Matchltem)
m=mySport.Score+m;//女子运动员的成绩
}
}
Console.WriteLine("{0}的获奖情况\t男子运动员的成绩为:{1}\t女子运动员的成绩为:{2}\t学校的总成绩为:{3}",school,k,m,k+m);
} //统计学校的总成绩,男子运动员的成绩,女子运动员的成绩。
if(n==2)
{
for(int x=0;x<school2.Length;x++)
{
k=0;m=0;
for(int y=0;y<athlete.Count;y++)
{
Sport mySport=(Sport)athlete[y];
for(int j=0;j<manmatch.Length;j++)
{
if(school2[x]==mySport.School&&manmatch[j]==mySport.Matchltem)
k=mySport.Score+k;
}
for(int j=0;j<womenmatch.Length;j++)
{
if(school2[x]==mySport.School&&womenmatch[j]==mySport.Matchltem)
m=mySport.Score+m;
}
}
Console.WriteLine("{0}的获奖情况\t男子运动员的成绩为:{1}\t女子运动员的成绩为:{2}\t学校的总成绩为:{3}",school2[x],k,m,k+m);
}//输出所有学校的总成绩,男子运动员的成绩,女子运动员的成绩。
}
}while(n!=0);
}

}
}

2007-01-09 14:21
zouchao
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2006-12-14
收藏
得分:0 
呵呵~
都是初学者大家相互讨论一下

2007-01-09 14:27
baiziyun
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-1-29
收藏
得分:0 
不错的#顶

2007-02-11 20:00
jinpeng2112
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-4-19
收藏
得分:0 
hao d  
2007-04-19 21:41
yu2824029
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-4-21
收藏
得分:0 
不错!
2007-04-21 19:34
vfoxer
Rank: 2
等 级:论坛游民
威 望:1
帖 子:136
专家分:21
注 册:2006-9-12
收藏
得分:0 
干脆把源文件提供上来大家看看啊

狐狸天堂:http://www.
我的百度空间:http://hi.baidu.com/vfoxer
2007-04-22 08:09
ccec309
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-4-16
收藏
得分:0 
谢谢啊
2007-04-23 18:47
xatlan1
Rank: 1
来 自:新疆-吐鲁番
等 级:新手上路
帖 子:129
专家分:0
注 册:2009-4-23
收藏
得分:0 
好长的代码啊
高手
先顶

-----------哼!谁说不可以---------------------------
2010-06-03 00:20
快速回复:[原创]c#运动会管理系统
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015835 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved