#include#include int main() { std::set mySet {1, 2, 3, 3, 3, 4, 5}; int key = 3; std::cout << "The number of occurrences of " << key << " is " << mySet.count(key) << std::endl; return 0; }
The number of occurrences of 3 is 3
#include#include int main() { std::set mySet {1, 2, 3, 3, 3, 4, 5}; std::cout << "The number of unique elements is " << mySet.size() << std::endl; return 0; }
The number of unique elements is 5Package library: Standard Template Library (STL)