Playground
#include <iostream> #include <set> using namespace std; int main() { //SET set<int> s; for (int i=0; i<10; i++) s.insert(i); cout << s.size() << endl; //pechati '10' for (int i=0; i<5; i++) s.insert(i); //nema efekt cout << s.size() << endl; //pechati '10' s.erase(2); s.erase(8); cout << s.size() << endl; //pechati '8' //MULTISET multiset<int> ms; for (int i=0; i<10; i++) ms.insert(i); cout << ms.size() << endl; //pechati '10' for (int i=0; i<5; i++) ms.insert(i); cout << ms.size() << endl; //pechati '15' ms.erase(2); //se brishat dvete 2-ki ms.erase(8); cout << ms.size() << endl; //pechati '12' return 0; }
Input data
Program output
no input
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!