1#include <iostream>
2#include <algorithm>
3#include <array>
4using namespace std;
5
6int main() {
7 array<int, 5> arrayfind{ 3,4,1,2,5 };
8 int Finding = 2;//an element to find
9 bool Founded;
10
11 Founded = binary_search(arrayfind.begin(), arrayfind.end(), Finding);
12 //if the element that you're looking for is in the array,
13 //bool Founded will be true
14 if (Founded == true) {
15 cout << Finding << " Is in the array!";
16 }
17 else {
18 cout << Finding << " Is not in the array!";
19 }
20}