C++ map from string key to string value

Description

C++ map from string key to string value

#include <iostream> 
#include <map> 

using namespace std; 

int main() //from  ww w  . j  ava 2  s  .  c  om
{ 
    map<string, string> marriages; 

    marriages["Tom"] = "T"; 
    marriages["Harry"] = "H"; 

    cout << marriages["Tom"] << endl; 
    cout << marriages["Harry"] << endl; 

    return 0; 
}



PreviousNext

Related