#include<iostream>
#include<map>
using namespace std;
int main(){
map<string,int> mp;
mp["hi"]=5;
string x="every";
int y=100;
mp[x]=y;
if(mp.count("word"))
;//是否存在word?
mp.erase("hi");
mp.size();
for(map<string,int>::iterator it=mp.begin();
it!=mp.end();it++){
string k=it->first;
int v=it->second;
cout<<k<<" "<<v<<endl;
}
return 0;
}
STL之map模板(映射)
猜你喜欢
转载自blog.csdn.net/m0_51794965/article/details/114360287
今日推荐
周排行