Set Member Functions in C++

#include <iostream>
#include <set>
using namespace std;

int main()
{
    set<int> s = {9, 5, 4, 7, 83, 90};
    cout << "Set size is : " << s.size() << endl;
    s.clear();
    if (s.empty())
    {
        cout << "The set is empty :" << endl;
    }
    else
    {
        cout << "Set is not empty: " << endl;
    }
    return 0;
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *