c++ hashmaps

#include <iostream>
#include <unordered_map>

int main() {
    // Step 1: Declare an unordered_map
    std::unordered_map<int, std::string> myMap;

    // Step 2: Insert key-value pairs into the unordered_map
    myMap.insert({1, "One"});
    myMap.insert({2, "Two"});
    myMap[3] = "Three";

    // Step 3: Access elements using keys
    std::cout << "Value at key 2: " << myMap[2] << std::endl;

    // Step 4: Check if a key exists in the unordered_map
    if (myMap.find(3) != myMap.end()) {
        std::cout << "Key 3 found. Value: " << myMap[3] << std::endl;
    } else {
        std::cout << "Key 3 not found." << std::endl;
    }

    // Step 5: Iterate through the unordered_map
    for (const auto& pair : myMap) {
        std::cout << "Key: " << pair.first << ", Value: " << pair.second << std::endl;
    }

    // Step 6: Erase an element by key
    myMap.erase(2);

    // Step 7: Check if the unordered_map is empty
    if (myMap.empty()) {
        std::cout << "The unordered_map is empty." << std::endl;
    } else {
        std::cout << "The unordered_map is not empty." << std::endl;
    }

    return 0;
}