#include#include int main() { std::set mySet; mySet.insert(3); mySet.insert(6); mySet.insert(1); std::cout << "Size of set: " << mySet.size() << std::endl; return 0; }
#includeIn this code, a set of integers is initialized with five elements. The `erase` function removes the element with value 4 from the set. The output shows the size of the set is now four. The `set` container is part of the Standard Template Library (STL), which is a package of C++ libraries.#include int main() { std::set mySet = {1, 2, 3, 4, 5}; mySet.erase(4); std::cout << "Size of set: " << mySet.size() << std::endl; return 0; }