运行 ❯
获取
自己的
网站
×
更改方向
更改主题,深色/浅色
转到 Spaces
#include <iostream> #include <map> using namespace std; int main() { map<string, int> people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} }; // Add new elements people["Jenny"] = 22; people["Liam"] = 24; people["Kasper"] = 20; people["Anja"] = 30; cout << "Jenny is: " << people.at("Jenny") << "\n"; cout << "Liam is: " << people.at("Liam") << "\n"; return 0; }
珍妮为:22
利亚姆为:24