I dont know what to do. My tabulate function won't work for multiple eliminated candidates and multiple rounds of preferences. The rest is fine, as check50 states:
:) tabulate counts votes when all candidates remain in election :) tabulate counts votes when one candidate is eliminated :( tabulate counts votes when multiple candidates are eliminated tabulate function did not produce correct vote totals :( tabulate handles multiple rounds of preferences tabulate function did not produce correct vote totals
(I can't use the debugging feature either. It doesn't seem to work with programs that get input from the command line (argv). It won't show the variables in main, just 2 or 3 variables in functions (e.g. i and j from the loops). But that's another story -.-')
Might you take a look at my code? I know, I could blindly take some code from someone else, but I want to understand, what is missing in mine. Would really appreciate your help!
void tabulate(void)
{
int preference_level;
for (int i = 0; i < voter_count; i++)
{
preference_level = 0;
for (int j = 0; j < candidate_count; j++)
{
if (preferences[i][preference_level] == j)
{
if(candidates[j].eliminated == false)
{
candidates[j].votes++;
}
else
{
preference_level++;
}
}
}
}
return;
}
Greetings from Germany.