#include<iostream>
#include<map>
using namespace std;
#define ll long long
int main(){
map<int,int> mp;
map<string,int> mpstr;
mpstr["wang"]=123;
mpstr["hui"]=321;
mp[10]=123;
mp[100]=321;
cout<<"mpstr-wang: "<<mpstr["wang"]<<endl;
cout<<"mpstr-hui: "<<mpstr["hui"]<<endl;
cout<<"mp-10: "<<mp[10]<<endl;
cout<<"mp-100: "<<mp[100]<<endl;
cout<<endl;
cout<<mp.count(10)<<endl;
cout<<mp.count(1)<<endl;
mp[10]=1;
mp[1]=10;
cout<<mp.count(10)<<endl;
cout<<mp.count(1)<<endl;
map<int,int>::iterator it;
return 0;
}
map
最新推荐文章于 2023-12-10 09:00:00 发布