Simple insert
1 2 3 4 5 6 7 8 |
map<string, int> dataMap; // Two methods to insert // 1. Insert with pair dataMap.insert(pair<string, int>("TESTING", 1)); // 2. Insert with array dataMap["TESTING"] = 1; |
Access to second element using key (C++ 11)
1 2 3 |
cout << dataMap.at("TESTING"); // Console output = 1 |
Iterate…