Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <set>
- using namespace std;
- set <int> s;
- int main()
- {
- int i, x, n;
- set<int>::iterator it;
- ifstream fin("sir.in");
- fin >> n;
- for (i = 1; i <= n; i++)
- {
- fin >> x;
- s.insert(x);
- }
- fin.close();
- cout << s.size()<<"\n";
- if (s.find(3) != s.end())
- cout << "3 exista\n";
- else cout << "3 nu exista\n";
- for (it = s.begin(); it != s.end(); it++)
- cout << *it << " ";
- cout <<"\n";
- it = s.begin();
- advance(it, 4);
- s.erase(it);
- //s.erase(4);
- for (it = s.begin(); it != s.end(); it++)
- cout << *it << " ";
- cout <<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment