wjandrea
0
Q:

map declaration c++

map <typename,map<typename,typename>> mp;
mp[key1].insert(make_pair(key2,value));
0
//assuming your variables are called : variables_
#include <map>
#include <string>

std::map<int, std::string> 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"
0

New to Communities?

Join the community