Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <set>
- using namespace std;
- int main() {
- set<int> my_set;
- my_set = {1,2,3};
- for(int i = 0 ; i < my_set.size() ; i++){
- cout << my_set.count(i+1) << " ";
- }
- cout << endl;
- for(int i = 0 ; i < my_set.size() ; i++){
- auto it = my_set.find(i+1);
- cout << *it << " ";
- }
- auto it_begin = my_set.begin();
- cout<<*it_begin;//my_set.end();
- cout << endl;
- my_set.insert(1);
- cout << endl;
- //el = 10
- //if (my_set.count(el) == 1){}
- // if (my_set.find(el) != my_set.end()){}
- my_set = {1,2,3,4};
- my_set.erase(2); // erase(my_set.find(2))
- multiset<int> my_kek;
- my_kek = {1,1,2,2,3,3,4,5};
- my_kek.erase(2); // {1,2,3,3,4,5}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement