For some reason my c++ solution looks good using a cerr, but when I use a cout, it gives me the error "Invalid command sent. It should be an integer from 0 to 7." I used a value returning function in there of type int. How can it be that I'm not sending an interger when I send the direct output of the function to the cout like cout << theTarget(heights) << endl;
here is my function:
int theTarget(vector &v){
int tallest = v.at(0), target = 0, index = 0;
for(int i = 0; i < v.size(); i++) {
if (v.at(i) >= tallest) {
target = v.at(i);
tallest = v.at(i);
index = i;
}
}
v.at(index) = 0;
return (int)target; // I even type casted
}
Any help would be appreciated.