# Runoff Help: Tabulate Handles Multiple Rounds of Preferences

I cannot figure out why I am getting rejected on check50 for ":( tabulate handles multiple rounds of preferences - tabulate function did not produce correct vote totals". I get green successful marks on all other checks, including ":) tabulate counts votes when multiple candidates are eliminated".

Below is my tabulate function. Any help to point me in the right direction is appreciated.

``````void tabulate(void)
{

int vote_num = 0;
int rank = 0;

for (int i = 0; i < voter_count; i++)
{
vote_num = preferences[i][rank];

if (candidates[vote_num].eliminated == false)
{
}
else
{
for (rank = 0; rank < candidate_count; rank++)
{
if (candidates[preferences[i][rank]].eliminated == false)
{
break;
}

}
}

}

return ;

}
``````

``````void tabulate(void)
{
for (int i = 0; i < voter_count; i++)
{
for (int j = 0; j < candidate_count; j++)
{
if (candidates[preferences[i][j]].eliminated == false)
{
break;
}
}
}
return;
}

``````

I would take a look at the logic behind `vote_num` because I'm not sure if that is working how you intend it to. You initiate it to one, never increment it, and use it to access a candidate in

``````if (candidates[vote_num].eliminated == false)
{
to determine if your function should run the above code or the `else` statement. Now, I'm not sure how you are treating your `candidates` array elsewhere in your code, but this snippet makes it look like you are always incrementing the vote for the first candidate in the array by 1 each time you tabulate votes, independent of whether they have votes. This function isn't passed a parameter, so I am assuming that this `candidates` array is what is storing each voter's preferences (though you have a `preferences` array that would seem to do that)?