Advertisement
Guest User

теория1.1

a guest
Dec 14th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <set>
  5. using namespace std;
  6. int main() {
  7. set<int> my_set;
  8. my_set = {1,2,3};
  9. for(int i = 0 ; i < my_set.size() ; i++){
  10. cout << my_set.count(i+1) << " ";
  11. }
  12. cout << endl;
  13. for(int i = 0 ; i < my_set.size() ; i++){
  14. auto it = my_set.find(i+1);
  15. cout << *it << " ";
  16. }
  17. auto it_begin = my_set.begin();
  18. cout<<*it_begin;//my_set.end();
  19.  
  20. cout << endl;
  21.  
  22. my_set.insert(1);
  23. cout << endl;
  24. //el = 10
  25. //if (my_set.count(el) == 1){}
  26. // if (my_set.find(el) != my_set.end()){}
  27. my_set = {1,2,3,4};
  28. my_set.erase(2); // erase(my_set.find(2))
  29.  
  30. multiset<int> my_kek;
  31. my_kek = {1,1,2,2,3,3,4,5};
  32.  
  33. my_kek.erase(2); // {1,2,3,3,4,5}
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement