Question
Look at the following vector definition:vector<int> v = {7, 2, 1, 6, 4, 3, 5};Write code that displays a message indicating whether the value 6 is found in the vector. Use the STL binary_search() algorithm to search the vector for the value 6.
Step 1
You will need to include `<iostream>` for input/output and `<vector>` for using the vector container. Additionally, include `<algorithm>` for the `binary_search` function. ```cpp #include <iostream> #include <vector> #include <algorithm> ``` Show more…
Show all steps
Your feedback will help us improve your experience
Watch the video solution with this free unlock.
EMAIL
PASSWORD