下载此文档

C++ 评委打分问题.docx


文档分类:管理/人力资源 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
#if 1
#include<iostream>
#include<>
using namespace std;
#define JudgeNum 5
#define PlayerNum 5
petitionResult
{
short num; //选手号码
char name[10]; //选手姓名
float score[JudgeNum]; //记录各评委给选手的打分
float average; //选手最后得分,去掉一个最高分和最低分后的平均分
public:
CompetitionResult();
CompetitionResult(short n,char *ps);
float MaxScore(); //求评委打的最高分
float MinScore(); //求评委打的最低分
void SetAvg(); //求选手的最后得分
float GetAvg(); //读选手的最后得分
short GetNo(int i); //求选手的编号
void SetNo(int i); //设置选手的编号
char * GetName(); //读选手的姓名
float GetScore(int j); //读第j个评委的打分
void SetScore(int k,float av); //记录第j个评委的打分
friend void petitionResult *pr,int n); //按最后得分从高到低排序
};
//CompetitionResult::CompetitionResult()
// {
// num=0;
//strcpy(name,"");
//for(int i=0;i<JudgeNum;i++)
// score[i]=;
//average=0;
//}
CompetitionResult::CompetitionResult(short n,char*ps)
{
num=n;
strcpy(name,ps);
for(int i=0;i<JudgeNum;i++)
score[i]=;
average=0;
}
petitionResult::MaxScore()
{ int max=score[0];
for(int i=0;i<JudgeNum;i++)
if(max<score[i])
max=score[i];
return max;
}
petitionResult::MinScore()
{ int min=score[0];
for(int i=0;i<JudgeNum;i++)
if(min>score[i]) min=score[i];
return min; }
petitionResult::SetAvg()
{ int i;float sum=;
for(i=0;i<JudgeNum;i++)
sum+=score[i];
sum=sum-MaxScore()-MinScore();
average=sum/(

C++ 评委打分问题 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人lyd13607
  • 文件大小15 KB
  • 时间2018-05-16