Similar Problems not available
In C++, the standard library gives us the facility to use the Sets as a type of associative containers in which each element has to be unique. The set::insert() is a C++ Standard Library function which is used to insert an element to the set container. After every insertion, the size of set increased by 1.
Set_Name.insert( Element );
Parameter: The set::insert() function accepts only single parameter:
Return value: The set::insert() function returns the iterator pointing to the inserted element.
#include <bits/stdc++.h>
using namespace std;
int main()
{
set<int> SET;
SET.insert(10);
SET.insert(4);
SET.insert(12);
SET.insert(15);
auto val = SET.find(3);
if (val != SET.end())
{
cout << "Element Found";
}
else
{
cout << "Element Not Found";
}
return 0;
}
Element Not Found