Skip to content

Instantly share code, notes, and snippets.

@RolandWarburton
Created September 22, 2019 00:15
Show Gist options
  • Save RolandWarburton/0469cd248dee20d49a88582a60c00b91 to your computer and use it in GitHub Desktop.
Save RolandWarburton/0469cd248dee20d49a88582a60c00b91 to your computer and use it in GitHub Desktop.
c++ maps basics
#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