Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ map lookup

// map::find
#include <iostream>
#include <map>

int main ()
{
  std::map<char,int> mymap {
    {'a', 50},
    {'b', 100},
    {'c', 150},
    {'d', 200}};

  std::cout << "c => " << mymap.find('c')->second << '
';

  return 0;
}
 
PREVIOUS NEXT
Tagged: #map #lookup
ADD COMMENT
Topic
Name
6+1 =