// declare a unordered_map (or even a normal map wouuld work) unordered_map<char, char> mapping; mapping['a'] = 'z'; // check if 'a' is present as key using find method if(mapping.find('a') != m.end()){ cout << "a is a key in mapping! "; }