for loop c++ map code example
Example: through map c++
//Since c++17
for (auto& [key, value]: myMap) {
cout << key << " has value " << value << endl;
}
//Since c++11
for (auto& kv : myMap) {
cout << kv.first << " has value " << kv.second << endl;
}