prints all the keys and values in a map c++
for (auto x : m) {
cout << x.first << " " << x.second << "\n";
}
prints all the keys and values in a map c++
for (auto x : m) {
cout << x.first << " " << x.second << "\n";
}
std::map get all keys
std::map<int, int> m;
std::vector<int> key, value;
for(std::map<int,int>::iterator it = m.begin(); it != m.end(); ++it) {
key.push_back(it->first);
value.push_back(it->second);
std::cout << "Key: " << it->first << std::endl();
std::cout << "Value: " << it->second << std::endl();
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us