Answers for "how can i print map in c++"

C++
1

print std map

for(auto it = myMap.cbegin(); it != myMap.cend(); ++it)
{
  std::cout << it->first << " " << it->second << std::endl;
}
Posted by: Guest on November-27-2021
1

prints all the keys and values in a map c++

for (auto x : m) {
cout << x.first << " " << x.second << "\n";
}
Posted by: Guest on April-13-2021

Browse Popular Code Answers by Language