#include#include using namespace std; int main() { unordered_set mySet = {1, 2, 3, 4, 5}; if (mySet.contains(3)) { cout << "Value 3 is found in the set." << endl; } else { cout << "Value 3 is not found in the set." << endl; } return 0; }
#includeOutput: Value pear is not found in the set. Explanation: This code creates an unordered_set named "mySet" with the values "apple", "banana", "orange", and "mango". The contains() function is then used to check if the string "pear" exists in the set. Since "pear" is not present in the set, the program outputs "Value pear is not found in the set." Package Library: The HashSet is a part of the C++ standard library, which is included with the language. Specifically, the "unordered_set" library is needed to use the HashSet in C++.#include using namespace std; int main() { unordered_set mySet = {"apple", "banana", "orange", "mango"}; if (mySet.contains("pear")) { cout << "Value pear is found in the set." << endl; } else { cout << "Value pear is not found in the set." << endl; } return 0; }