/* * Standard containers, std:.vector, exercise 7. */ #include #include #include #include using namespace std; int main() { vector v{ 12, 4, 18, 6, 8, 20, 2, 10, 16, 14 }; sort(begin(v), end(v), greater()); int x; do { cout << "Value to look for (0 to end)? "; cin >> x; if (binary_search(begin(v), end(v), x, greater())) cout << x << " was found.\n"; else if (x != 0) cout << x << " was not found.\n"; } while (x != 0); return 0; }