📜  地图声明 c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:55.484000             🧑  作者: Mango

代码示例1
//assuming your variables are called : variables_
#include 
#include 

std::map map_;
map_[1] = "mercury";
map_[2] = "mars";
map_.insert(std::make_pair(3, "earth"));
//either synthax works to declare a new entry

return map_[2]; //here, map_[2] will return "mars"