function for searching in map in c++

C++
// 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; 
} 
//use this function
unordered_map<int,int> m1;

m1.find(value of element you want to find);
Source

Also in C++: