map

#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;
}
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 黑客帝国 设计师:上身试试 返回首页