how to add an element to std::map

#include <iostream>
#include <map>

int main() {
    std::map<int, std::string> myMap;

    // Step 1: Define the key-value pair to be added
    std::pair<int, std::string> newElement(1, "Value1");

    // Step 2: Use the insert function to add the element to the map
    myMap.insert(newElement);

    // Alternatively, you can use the following single-line approach to insert
    // myMap.insert(std::make_pair(1, "Value1"));

    // Print the map to verify the addition
    for (const auto& entry : myMap) {
        std::cout << entry.first << ": " << entry.second << std::endl;
    }

    return 0;
}