演讲比赛
- 演讲说明:24名同学参加演讲比赛,分为三轮。前两轮淘汰赛,后一轮是决赛。
- 比赛方式:第一轮分4组,每组6人,每次随机分组,再进行比赛
每组按顺序演讲完,评委打分,淘汰最后三名选手,然后进行下一轮
第二轮剩下2个组,每组6人,每组再淘汰3人,进入决赛
第三轮剩下1组,最后淘汰3名,剩下前3名获胜
代码:
#include "stdafx.h"
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <algorithm>
#include <time.h>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;
class Student
{
public:
string m_name;
int m_scores[3];
};
//创建选手
void Init_Cadidate(map<int, Student>& map, vector<int>& v)
{
string seed = "ABCDEFGHIJKLMNOPQISTUVWXYZ";
for (int i = 0; i < 24; i++)
{
Student stu;
stu.m_name = "选手";
stu.m_name += seed[i];
for (int j = 0; j < 3; j++)
{
stu.m_scores[j] = 0;
}
C++ STL应用:模拟演讲比赛淘汰赛

本文使用C++ STL模拟了一场24名同学参与的演讲比赛,经过三轮淘汰赛决出前三名。每轮比赛通过随机分组和评分淘汰选手,最终展示如何在每组中获取前三名的排序结果。
最低0.47元/天 解锁文章
9194

被折叠的 条评论
为什么被折叠?



