主页
C++
C++ 映射
demo_maps_duplicate
运行 ❯
×
更改方向
保存代码
更改主题
#include
#include
using namespace std; int main() { map
people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} }; // Trying to add two elements with equal keys people.insert({"Jenny", 22}); people.insert({"Jenny", 30}); cout << "Jenny is: " << people.at("Jenny") << "\n"; return 0; }
Jenny is: 22