C++ array find method
#include <iostream>
#include <algorithm>
#include <array>
using namespace std;
int main() {
array<int, 5> arrayfind{ 3,4,1,2,5 };
int Finding = 2;//an element to find
bool Founded;
Founded = binary_search(arrayfind.begin(), arrayfind.end(), Finding);
//if the element that you're looking for is in the array,
//bool Founded will be true
if (Founded == true) {
cout << Finding << " Is in the array!";
}
else {
cout << Finding << " Is not in the array!";
}
}