how to iterate through a map in c++

#include <iostream>
#include <map>

int main() {
    std::map<std::string, int> myMap = {{"apple", 5}, {"banana", 3}, {"orange", 2}};

    for (auto it = myMap.begin(); it != myMap.end(); ++it) {
        std::cout << "Key: " << it->first << ", Value: " << it->second << std::endl;
    }

    return 0;
}