check if set contains element c++

#include <iostream>
#include <set>

int main() {
  std::set<int> mySet = {1, 2, 3, 4, 5};

  int element = 3;

  if (mySet.count(element)) {
    std::cout << "Set contains the element" << std::endl;
  } else {
    std::cout << "Set does not contain the element" << std::endl;
  }

  return 0;
}