Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: cmd color text c++ 
Cpp :: string in c++ 
Cpp :: what is function c++ 
Cpp :: c++ check that const char* has suffix 
Cpp :: intlen in c++ 
Cpp :: sliding window c++ 
Cpp :: google test assert exception 
Cpp :: Reverse a linked list geeksforgeeks in c++ 
Cpp :: arduino falling edge 
Cpp :: c++ stl vector get iterator from index 
Cpp :: Shuffle String leetcode solution in c++ 
Cpp :: c++ for loop syntax 
Cpp :: STD::ERASE FUNCTION IN C++ 
Cpp :: cpp vector popback 
Cpp :: compare values within within a vector c++ 
Cpp :: sum of n natural numbers 
Cpp :: remove linked list elements leetcode 
Cpp :: phi function (n log (log(n))) 
Cpp :: c++ last element of array 
Cpp :: cpp foreach 
Cpp :: linkedlist in c++ 
Cpp :: cpprestsdk send file 
Cpp :: why exceptions can lead to memory leaks 
Cpp :: error: use of parameter outside function body before ] token c++ 
Cpp :: print all variables separated by comma c++ 
Cpp :: c++ write number to registry 
Cpp :: convert string to double arduino 
Cpp :: decemal representation 
Cpp :: overwrite windows mbr c++ 
Cpp :: create dynamic variable c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =