#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
map<string, int> m;
m.insert(pair<string, int>("A", 100));
m.insert(pair<string, int>("G", 300));
m.insert(pair<string, int>("B", 200));
// Declare an iterator to a map<string, int>.
map<string, int>::iterator itr;
// Display the first element in m.
itr = m.begin();
cout << "Here is the first key/value pair in m: "
<< itr->first << ", " << itr->second << endl;
return 0;
}
|