Your main problem is here:
existsHigher([2,3,4,5,6],3);
The expression
[2,3,4,5,6]
does
not define a
vector<int>
. If you want a temporary vector of int, you'd need to use
existsHigher(vector<int>{2,3,4,5,6},3);
. That's C++11, though, so if your compiler is still using C++98, you have to construct the vector first. e.g:
vector<int> myvect;
for(int i = 2; i <= 7; ++i)
myvect.push_back(i);