# include <iostream>
# include <unordered_map>
# using namespace std;
int main() {
unordered_map<char, int> ma = {
{'a',1},
{'b',2},
{'c',3}};
// 法一。c++11
for (auto &p : ma) {
cout << p.first << ':' << p.second << endl;
}
// 法二
unordered_map<char, int>::iterator iter;
for (iter=ma.begin(); iter!=ma.end(); ++iter) {
cout << iter->first << ':' << iter->second << endl;
}
return 0;
}