This is my code...
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
bool searchVect(vector<int>, int);
int main()
{
bool answer;
int value;
vector<int> vect = {13579, 26791, 26792, 33445, 55555,
62483, 77777, 79422, 85647, 93121};
cout << "Enter the number to determine if there is a winner. \n";
cin >> value;
answer = searchVect(vect, value);
cout << "The answer of whether it was found is " << answer << endl;
return 0;
}
bool searchVect(vector<int> vect, int v)
{
bool answer = false;
answer = binary_search(vect.begin(), vect.end(), v);
return answer;
}
What i don't understand is how come the binary_search isn't recognized inside the function. If i need to pass something to the function then what? Also it possibe to make the function above a template with the class vector inside the function already being a template, so that both templates work in unison, the function and the vector class template that was passed to the function?