-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTLset.cpp
More file actions
40 lines (33 loc) · 714 Bytes
/
STLset.cpp
File metadata and controls
40 lines (33 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
#include<set>
using namespace std;
int main(int argc, char const *argv[])
{
set<int>s;
s.insert(5);
s.insert(5);
s.insert(5);
s.insert(5);
s.insert(1);
s.insert(6);
s.insert(6);
s.insert(6);
s.insert(0);
s.insert(0);
s.insert(0);
for(auto i: s){
cout << i << " ";
}cout << endl;
set<int> :: iterator it = s.begin();
it++;
s.erase(it);
for(auto i: s){
cout << i << " ";
}cout << endl;
cout << "5 id present or not " << s.count(5) << endl;
set<int> :: iterator itr = s.find(5);
for(auto it = itr; it != s.end(); it++){
cout << *it << " ";
}cout << endl;
return 0;
}