C++ examples for STL:map
Associating Objects with map
#include <iostream> #include <map> #include <string> using namespace std; int main() // ww w . j a v a 2s .com { map<string, string> marriages; marriages["Tom"] = "T"; marriages["Harry"] = "H"; cout << marriages["Tom"] << endl; cout << marriages["Harry"] << endl; return 0; }