Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ map loop through key value

#include <iostream>
#include <map>

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

    myMap["one"] = 1;
    myMap["two"] = 2;
    myMap["three"] = 3;

    for ( const auto &[key, value]: myMap ) {
        std::cout << key << '
';
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #map #loop #key
ADD COMMENT
Topic
Name
1+5 =