Check out example codes for "c++ map find". It will help you in understanding the concepts better.

Code Example 1

edit
play_arrow

brightness_4
// C++ program for illustration 
// of map::find() function 
#include <bits/stdc++.h> 
using namespace std; 
  
int main() 
{ 
  
    // initialize container 
    multimap<int, int> mp; 
  
    // insert elements in random order 
    mp.insert({ 2, 30 }); 
    mp.insert({ 1, 40 }); 
    mp.insert({ 3, 20 }); 
    mp.insert({ 4, 50 }); 
  
    cout << "The elements from position 3 in map are : \n"; 
    cout << "KEY\tELEMENT\n"; 
  
    // find() function finds the position at which 3 is 
    for (auto itr = mp.find(3); itr != mp.end(); itr++) 
        cout << itr->first 
             << '\t' << itr->second << '\n'; 
  
    return 0; 
}

Code Example 2

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

int main ()
{
  std::map<char,int> mymap;
  std::map<char,int>::iterator it;

  mymap['a']=50;
  mymap['b']=100;
  mymap['c']=150;
  mymap['d']=200;

  it = mymap.find('b');
  if (it != mymap.end())
    mymap.erase (it);

  // print content:
  std::cout << "elements in mymap:" << '\n';
  std::cout << "a => " << mymap.find('a')->second << '\n';
  std::cout << "c => " << mymap.find('c')->second << '\n';
  std::cout << "d => " << mymap.find('d')->second << '\n';

  return 0;
}

Learn ReactJs, React Native from akashmittal.com