[求助]stl中的map用法
#include<iostream>#include<map>
#include<utility>
using namespace std;
map<int,int>v;
map<int,int>::iterator mp;
int main()
{
int x,y;
for(int i=0;i<20;i++)
{
x=rand();y=rand();
cout<<x<<","<<y<<" ";
v.insert(make_pair<int,int>(4,6));
}
cout<<v.size();
mp=v.find(41);
cout<<(mp->first)<<" "<<(mp->second)<<" ";
cout<<endl;
for(mp=v.begin();mp!=v.end();++mp)
cout<<(mp->first)<<" "<<(mp->second)<<" ";
return 0;
}