#include <iostream>
#include <unordered_map>
int main() {
std::unordered_map<std::string, int> numberDictionary;
// Adding entries to the dictionary
numberDictionary["One"] = 1;
numberDictionary["Two"] = 2;
numberDictionary["Three"] = 3;
numberDictionary["Four"] = 4;
numberDictionary["Five"] = 5;
// Accessing and printing values from the dictionary
std::cout << "Number corresponding to 'Two': " << numberDictionary["Two"] << std::endl;
std::cout << "Number corresponding to 'Four': " << numberDictionary["Four"] << std::endl;
// Modifying dictionary entries
numberDictionary["Three"] = 33;
// Checking if a key exists in the dictionary
std::string keyToCheck = "Six";
if (numberDictionary.find(keyToCheck) != numberDictionary.end()) {
std::cout << keyToCheck << " is in the dictionary." << std::endl;
} else {
std::cout << keyToCheck << " is not in the dictionary." << std::endl;
}
// Removing an entry from the dictionary
std::string keyToRemove = "Five";
numberDictionary.erase(keyToRemove);
// Displaying the final contents of the dictionary
std::cout << "Final dictionary contents:" << std::endl;
for (const auto& entry : numberDictionary) {
std::cout << entry.first << ": " << entry.second << std::endl;
}
return 0;
}