Created
September 22, 2019 00:15
-
-
Save RolandWarburton/0469cd248dee20d49a88582a60c00b91 to your computer and use it in GitHub Desktop.
c++ maps basics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
using namespace std; | |
int main(int argc, char const *argv[]) | |
{ | |
map<string, int> mymap; | |
mymap.insert({"hello", 1}); | |
mymap.insert({"world", 1}); | |
// print map | |
for (auto i = mymap.begin(); i != mymap.end(); i++) | |
cout << i->first << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment