#include <iostream>
#include <map>
#include <algorithm>

using std::cout;
using std::endl;
using std::map;
using std::pair;
using std::string;

void PrintOut(const pair<string, string>& p) {
  cout << p.first << " says " << p.second << endl;
}

// For those curious... https://youtu.be/jofNR_WkoCE
// ... enjoy?
int main(int argc, char** argv) {
  map<string, string> animals;
  
  animals["dog"]  = "woof";
  animals["cat"]  = "meow";
  animals["fish"] = "blub";      // originally ""
  animals["seal"] = "ow ow ow";  // originally "honk"
  animals["fox"];

  auto it = animals.find("fox");

  if (it == animals.end()) {
    cout << "fox not found" << endl;
  } else {
    cout << "fox found!" << endl;
  } 

  cout << "iterating:" << endl;
  for_each(animals.begin(), animals.end(), &PrintOut);

  return EXIT_SUCCESS;
}