#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<int> numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    int target = 5;

    // 使用 std::binary_search() 函数在已排序的向量中查找指定的元素
    bool found = std::binary_search(numbers.begin(), numbers.end(), target);

    // 输出查找结果
    if (found) {
        std::cout << "Element " << target << " found in the vector." << std::endl;
    } else {
        std::cout << "Element " << target << " not found in the vector." << std::endl;
    }

    return 0;
}
