Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ unordered set count

// unordered_set::count
#include <iostream>
#include <string>
#include <unordered_set>

int main ()
{
  std::unordered_set<std::string> myset = { "hat", "umbrella", "suit" };

  for (auto& x: {"hat","sunglasses","suit","t-shirt"}) {
    if (myset.count(x)>0)
      std::cout << "myset has " << x << std::endl;
    else
      std::cout << "myset has no " << x << std::endl;
  }

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: #defie in c++ 
Cpp :: c++ insert vector into vector 
Cpp :: c++ void pointer 
Cpp :: multiple objects in vector C++ 
Cpp :: cf 633b trivial problem explanation 
Cpp :: convert preorder to postorder calculator 
Cpp :: c++ ide online 
Cpp :: convert c++ to python online 
Cpp :: 7 9 C:UsersAliyahDocumentsshut up.cpp [Error] expected unqualified-id before string constant 
Cpp :: C++ (ISO) 
Cpp :: C++ Features 
Cpp :: c++ code 2d block 
Cpp :: random 1 diem tren man hinh bang dev c 
Cpp :: Arduino Access Point ESP8266 
Cpp :: how to display score using SDL in c++ 
Cpp :: how to store array of string with spaces in c++ stl 
Cpp :: Check if two stacks are the same using C++ 
Cpp :: user inptu in cpp 
Cpp :: import matrix from excel to matlab 
Cpp :: FINAL CODES_MY_OS_LAB 
Cpp :: c++ projects 
Cpp :: cin in c++ 
Cpp :: c++ permutation 
Cpp :: c vs c++ vs c# 
Cpp :: c++ error 0xC0000005 
C :: color text in C 
C :: boolean in c 
C :: octave dot operator 
C :: how to search in a file in c 
C :: populate a map c++ 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =