map

#include<iostream>
#include <map>
using namespace std;

int main()
{

    map<string ,int > m;
        string str1,str2;
        cin>>str1>>str2;
        int id1 = m[str1];
         m[str2] = 110;

cout<<str1<<" "<<id1<<endl;
cout<<str2<<" "<<m[str2]<<endl;
    return 0;
}

原文地址:https://www.cnblogs.com/qie-wei/p/10160248.html