![]() |
#2
bczgvip2010-03-20 19:24
|
void TopList::DisplayTopList() //排行榜
{
map<string,int> mapstring; //构造map模板的类型
mapstring.insert(pair<string, int >(name,humanRecord)); //name是一个储存名字的数组,humanRecord是一个变量
map<string,int>::iterator iter;
cout<< " 姓名"<<" 得分\n ";
for(iter = mapstring.begin(); iter != mapstring.end(); iter++)
{
cout<<iter->first<<" "<<iter->second<<endl;
}
为何只能打印数组最后一个人的信息?本人在编写一个石头剪子布的程序,这个是排行榜。总是实现不了。。。