运行 ❯
建立您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <map> using namespace std; int main() { map<string, int> people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} }; // Loop through the map with an iterator for (auto it = people.begin(); it != people.end(); ++it) { cout << it->first << " is: " << it->second << "\n"; } return 0; }
Adele is: 45
Bo is: 29
John is: 32