Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C++编写以下程序:该程序要求使用者输入12名足球队员的名字,编号,得分数,然后以表格的形式输出
C++编写以下程序:该程序要求使用者输入12名足球队员的名字,编号,得分数,然后以表格的形式输出
#包含?& ltiostream & gt

#包含?& ltvector & gt

#包含?& lt字符串& gt

#包含?& lt迭代器& gt

使用?命名空间?std

结构?数据项{

字符串?玩家;

int?ID;

int?分数;

};

int?main()

{

数据项?玩家;

字符串?冠军;

int?topscore?=?;向量& ltdataitem & gt?记录;

对于(?int?我?=?;?我?& lt?4;?++我?)

{

cout?& lt& lt?“玩家”?& lt& lt?i+1?& lt& lt?":"?& lt& lt?endlcin?& gt& gt?玩家玩家?& gt& gt?玩家。ID?& gt& gt?theplayer.score

如果(?theplayer.score?& lt??)

{

cout?& lt& lt?“分数?不能?是吗?否定!?试试?又来了"?& lt& lt?endl

cout?& lt& lt?“玩家”?& lt& lt?i+1?& lt& lt?":"?& lt& lt?endlcin?& gt& gt?玩家玩家?& gt& gt?玩家。ID?& gt& gt?theplayer.score

}

如果(?topscore?& lt?theplayer.score?)

{

topscore?=?theplayer.score

冠军?=?theplayer.player}

records . push _ back(the player);}

for(?向量& ltdataitem & gt*迭代器?它?=?records . begin();?它?!=?records . end();?++it?)

{

cout?& lt& lt?(*it)。玩家?& lt& lt?" \t "?& lt& lt?(*it)。ID?& lt& lt?" \t "?& lt& lt?(*it)。得分?& lt& lt?endl}

cout?& lt& lt“那个?冠军:“?& lt& lt?冠军?& lt& lt?":"?& lt& lt?topscore?& lt& lt?endl

退货?;

}