Challenge 2: std::find With a Present and an Absent Value — Possible Solution ==================================================================== #include #include #include int main() { std::vector nums = {5, 15, 25, 35}; auto found = std::find(nums.begin(), nums.end(), 25); if (found != nums.end()) { std::cout << "Found" << std::endl; } else { std::cout << "Not found" << std::endl; } auto missing = std::find(nums.begin(), nums.end(), 99); if (missing != nums.end()) { std::cout << "Found" << std::endl; } else { std::cout << "Not found" << std::endl; } return 0; } Output: Found Not found WHY THIS WORKS AS AN ANSWER ------------------------------ 25 genuinely exists in nums, so std::find returns an iterator pointing at it -- not equal to end() -- correctly reporting "Found." 99 doesn't exist anywhere in nums, so std::find returns end() itself, which the check `missing != nums.end()` correctly identifies as false, reporting "Not found" -- exactly the end()-as-sentinel idiom the chapter describes as used constantly throughout the STL.