set size() in C++

size(): This function returns the size of the set. 

This function is available in the below file.

File: stl_set.h

Parameters: No parameters are required for this function.

Syntax:

st.size()

For Example:

st = {1,2,3,4}

st.size() = > It returns 4.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    set<intst;
    st.insert({1342});

    cout << st.size() << "\n";

    return 0;
}


No comments:

Post a Comment