#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <ctime>
using namespace std;
// 自己的通用数组类
class Person
{
   public:
   Person
   (
      string name, int score
   )
   {
      this->m_name=name;
      this->m_score=score;

   }
   string m_name;
   int m_score;
};
void cretePerson(vector<Person>&v)
{
   string nameSeed="ABCD";
   for (int i=0;i<5;i++)
   {
      string name = "选手";
      name +=nameSeed[i];
      int score=0;
      Person p(name ,score);
      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++)
    {
       int score =rand()%41+60;
       d.push_back(score);
    }
    sort(d.begin(),d.end());
    d.pop_back();
    d.pop_front();
   int sum=0;
   for (deque<int>::iterator dit=d.begin();dit!=d.end();dit++)
   {
      sum+=*dit;
   }
   int avg=sum/d.size();
   // 将平均分放到人身上
   it->m_score=avg;
   // cout<<it->m_name<<it->m_score<<endl;
 }
}
int main()
{
   srand((unsigned int )time(NULL));
   vector<Person>v;
   cretePerson(v);
  
   setScore(v);
    for (int i=0;i<4;i++)
   {
      cout<<v[i].m_name<<"    "<<v[i].m_score<<endl;
   }

    
    system("pause");
    return 0; 
}