Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void set_demo()
- {
- set<int> s;
- set<int>::iterator it;
- for (int i=0; i<10; i++)
- s.insert(10-i);
- for (it=s.begin(); it!=s.end(); it++)
- cout<<*it<<' ';
- cout<<endl;
- //stergeri & inlocuiri
- set<int>::iterator itr;
- itr=s.find(6);
- s.erase(itr);
- itr=s.find(3);
- s.insert(1);
- if (!s.empty())
- for (it=s.begin(); it!=s.end(); it++)
- cout<<*it<<' ';
- s.clear();
- if (s.empty())
- cout<<"set is empty"<<endl;
- ///ordonare
- set <int, greater <int> > gquiz1;
- gquiz1.insert(40);
- gquiz1.insert(30);
- gquiz1.insert(60);
- gquiz1.insert(20);
- gquiz1.insert(50);
- gquiz1.insert(50);
- gquiz1.insert(10);
- // printing set gquiz1
- set <int, greater <int> > :: iterator it2;
- cout << "\nThe set gquiz1 is : ";
- for (it2 = gquiz1.begin(); it2 != gquiz1.end(); ++it2)
- {
- cout << '\t' << *it2;
- }
- cout << endl;
- }
- void multiset_demo()
- {
- }
- int main()
- {
- set_demo();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement