0
bool vote(int rank, string name, int ranks[])
{
    for (int i = 0; i < candidate_count; i++)
    {
        if (strcmp(name, candidates[i]) == 0)
        {
            ranks[rank] = name;
            printf("rank was successfuly recorded");
            return true
        }
    }
    
    // TODO
    return false;
}

error message enter image description here

1 Answer 1

0

ranks is an array of integers as declared in the function signature. name is a string. Recall from the spec [emphasis added]:

ranks[i] is the index of the candidate who is the ith preference for the voter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .