有五名歌唱选手参加比赛,共有十个评委对其打分 去掉其中最高分和最低分 利用随机数对其打分 并且输出得分最高者

#include<iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
#include<deque>
#include<ctime>
//评委打分案例
//有五名歌唱选手参加比赛,共有十个评委对其打分  去掉其中最高分和最低分 获取其均值 均值大的人获胜
class person
{
public:
	//构造函数
	person(string name, int score)
	{
		this->m_name = name;
		this->m_score = score;
	}
	string m_name;//姓名
	int m_score;//平均分
};
void createperson(vector<person>& v)
{
	string nameseec = "ABCDE";
	//创建五个人
	for (int i = 0; i < 5; ++i)
	{
		string name = "选手";
			name += nameseec[i];
			//成绩默认设置为0分
				int score = 0;
				//创建五个人
				person p(name, score);
				//把人放入vector容器中
				v.push_back(p);
				
	}
}
//给选手设置分数
void setscore(vector<person>& v)
{
	
	//对五个选手进行打分
	for (vector<person>::iterator it = v.begin(); it != v.end(); it++)
	{
		deque<int>d;
		for (int i = 0; i < 10; i++
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值