stl map
#include <stdio.h>
#include <map>
#include <iostream>
using namespace std;
int main( )
{
map<int, string>stu;
int a, b, i, j;
char str[20];
while (scanf("%d",&a) != EOF ) {
for (i = 0; i < a; i++) {
scanf("%d%s",&b,str);
//stu[b] = str;
stu.insert(make_pair(b,str));
}
map<int,string>::iterator iter;
for(iter = stu.begin( ); iter != stu.end( );iter++)
cout<<(*iter).first<<" "<<iter->second<<endl;
}
return 0;
}
posted on 2011-07-28 20:13 more think, more gains 阅读(145) 评论(0) 收藏 举报
浙公网安备 33010602011771号