Search
 
SCRIPT & CODE EXAMPLE
 

CPP

find with hash set

#include <unordered_set>
#include <string>
#include <iostream>

int main() {
  std::unordered_set<std::string> planets{
    {"Venus"},
    {"Earth"},
    {"Mars"},
  };

  auto it = planets.find("Earth");
  if (it != planets.end()) {
    std::cout << *it << "
";
  } else {
    std::cout << "No such planet.
";
  }

  it = planets.find("PlanetX");
  if (it != planets.end()) {
    std::cout << *it << "
";
  } else {
    std::cout << "No such planet.
";
  }
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: zsh: segmentation fault ./provided_files.exe erosion X . 
Cpp :: ue4 c++ enum variable declaration 
Cpp :: PUBG_APIKEY=<your-api-key npm t 
Cpp :: sinh nhi phan c++ 
Cpp :: how to open program in c++ 
Cpp :: Polycarp found a rectangular table consisting of n rows and m columns. He noticed that each cell of the table has its number, obtained by the following algorithm "by columns": codeforces solution 
Cpp :: Hash Sort in C++ 
Cpp :: c++ int max value 
Cpp :: delete[] cpp 
Cpp :: C++ initializing a thread with a public function of a class 
Cpp :: C++ singleton prevent copy 
Cpp :: Buy 2 Get 1 Free codechef solution in c++ 
Cpp :: c++ single comment 
Cpp :: c++ str 
Cpp :: C++ OpenCV Face Recognition 
Cpp :: c++ comments 
Cpp :: can map return a value to a variable in c++ 
Cpp :: nodeafternode 
Cpp :: c++ map access 
Cpp :: rand() and srand() in C/C++ 
Cpp :: C++ with SVD 
Cpp :: catalan numbers c++ 
Cpp :: distructor of the node of the link list 
Cpp :: how to make a substring after certain position 
Cpp :: can derived class access base class non-static members without object of the base class 
Cpp :: C++ Battery Low 
Cpp :: Structure of s void function 
Cpp :: how to srt vector array 
Cpp :: nlohmann json, writing to json file 
Cpp :: scope resolution operator in c++ 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =