Im trying to create a recursive function that contains a vector of numbers and has a key, which is the number we are looking for in the vector.
Each time the key is found the function should display a count for how many times the key appears in the vector.
For some reason my recursive function is only returning the number 1 (disregard the 10 I was just testing something)
Here's my code:
int recursive_count(const vector<int>& vec, int key, size_t start){
    if (start == vec.size())
        return true;
    return (vec[start] == key? 23 : key)
        && recursive_count(vec, key, (start+1));
}
int main() {
    vector <int> coco;
    for (int i = 0; i<10; i++) {
        coco.push_back(i);
    }
    cout << coco.size() << endl;
    int j = 6;
    cout << recursive_count(coco, j, 0) << endl;
}
 
     
     
     
     
    