c++ map value int to string

#include <iostream>
#include <map>

int main() {
    // Step 1: Declare a map with int keys and string values
    std::map<int, std::string> intToStringMap;

    // Step 2: Insert key-value pairs into the map
    intToStringMap[1] = "One";
    intToStringMap[2] = "Two";
    intToStringMap[3] = "Three";

    // Step 3: Access and print values using keys
    std::cout << "Value for key 1: " << intToStringMap[1] << std::endl;
    std::cout << "Value for key 2: " << intToStringMap[2] << std::endl;
    std::cout << "Value for key 3: " << intToStringMap[3] << std::endl;

    // Step 4: Check if a key exists in the map
    int keyToCheck = 2;
    if (intToStringMap.find(keyToCheck) != intToStringMap.end()) {
        std::cout << "Key " << keyToCheck << " exists in the map." << std::endl;
    } else {
        std::cout << "Key " << keyToCheck << " does not exist in the map." << std::endl;
    }

    return 0;
}