Playground
#include <iostream> #include <set> using namespace std; int main() { //SET set<int> s; for (int i=0; i<10; i++) s.insert(i); if (s.find(5) != s.end()) cout << "BINGO" << endl; //pechati 'BINGO' cout << s.count(2) << endl; //pechati '1' s.erase(2); cout << s.count(2) << endl; //pechati '0' set<int>::iterator it = s.begin(); while (it != s.end()) { cout << *it << " "; it++; } cout << endl; //pechati '0 1 3 4 5 6 7 8 9 ' //MULTISET multiset<int> ms; for (int i=0; i<10; i++) ms.insert(i); for (int i=0; i<5; i++) ms.insert(i); cout << ms.count(2) << endl; //pechati '2' //izbrishi edna 2-ka ms.erase(ms.find(2)); cout << ms.count(2) << endl; //pechati '1' //izbrishi gi site elementi pomegju 5 i 8 (bez 8) ms.erase(ms.find(5), ms.find(8)); return 0; }
Input data
Program output
no input
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!