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)
{
candidates[vote_num].votes++;
}
else
{
for (rank = 0; rank < candidate_count; rank++)
{
if (candidates[preferences[i][rank]].eliminated == false)
{
candidates[preferences[i][rank]].votes++;
break;
}
}
}
}
return ;
}