Set in C++ :
STL in C++ are of great use when it comes to competitive programming. So here were are going to have look at the set stl. This post is based on what I learned about set and I have tried in simple english.
How to declare a map :
First include the header file #include
then you are ready to go with your map!!!
To clear the set :set<int> s;
We can clear the function using clear() function.
s.clear();
We can insert into a using insert() function.
s.insert(10);
We have to use find() function to check whether an element is present if it equals s.end() element is not there in set.
cout<<s.find(10)==s.end();//prints 0 if 10 is not there
Remember clear deletes the entire set whereas erase() function deletes just one element.