fork download
  1. #include<iostream>
  2. #include<set>
  3.  
  4. int main() {
  5. // Create a set object holding integers
  6. std::set<int> mySet {1,2,3,4,-5};
  7. if (mySet.count(1) != 0) {
  8. std::cout << "1 : is not an element of myset" << std::endl;
  9. }
  10. else {
  11. std::cout << "1 : is a element of mySet" << std::endl;
  12. }
  13. if (mySet.count(12) == 0) {
  14. std::cout << "12 : is not an element of myset" << std::endl;
  15. }
  16. else {
  17. std::cout << "12 : is a element of mySet" << std::endl;
  18. }
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 4348KB
stdin
Standard input is empty
stdout
1 : is not an element of myset
12 : is not an element of myset