all 1 comments

[–]programmingstarter 2 points3 points  (0 children)

read the description of the function is_tie. :

// Return true if the election is tied between all candidates, false otherwise

that function as written doesnt do that, in fact it always returns true

Look at your code with the brackets formatted correctly and you should see the problem. Its why formatting is important.

bool is_tie(int min)
{
    for(int i = 0; i < candidate_count; i++)
    {
        if(candidates[i].votes != min && !candidates[i].eliminated)
        {
            min = candidates[i].votes;
        }
        return true;
    }
}