#include <bits/stdc++.h>
using namespace std;
int main() {
unordered_map<string, int> mp;
mp["abc"] = 1;
mp["xy"] = 2;
mp["pqr"] = 3;
auto it = mp.find("xy");
it++;
if(it != mp.end())
cout << it->first << " " << it->second;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
unordered_map<string, int> mp;
mp["abc"] = 1;
mp["xy"] = 2;
mp["pqr"] = 3;
auto it = mp.find("xy");
it++;
if (it != mp.end())
cout << it->first << " " << it->second;
return 0;
}
print any pair of map except ("xy", 2) this pair.
3 pqr
Garvage values
Error
This question is part of this quiz :
C++ Unordered Map