I am so close to a successful runoff program, but I've been having issues with the tabulation section. I decided that this was a good place to implement a recursive function, but it is a new concept to me so maybe I'm missing something. The rest of my code is perfectly functional. The only check50 error I am getting is this:
:( tabulate counts votes when multiple candidates are eliminated tabulate function did not produce correct vote totals
My code is as follows:
void tabulate(void)
{
for (int voter = 0; voter < voter_count; voter++)
{
int rank = 0;
elim_test(voter, rank);
}
return;
}
//recursive function for tabulating non-eliminated candidates
void elim_test(int voter, int rank)
{
if (candidates[preferences[voter][rank]].eliminated == false)
{
candidates[preferences[voter][rank]].votes++;
return;
}
elim_test(voter, rank++);
}
What am I missing here?