I have been stuck at the tabulate function for quite some time, I'm able to code all the other functions except for this tabulate functions.
If possible do help me look to see what wrong with the tabulate function. The logic that I have used is all commented within the code itself.
Your help is much appreciated thank you!
void tabulate(void)
{
for (int b = 0 ; b < voter_count ; b++)
{
for (int c = 0 ; c < candidate_count ; c++)
{
//if candidates name corresponds to that of the preferences index
if (strcmp(candidates[c].name, candidates[preferences[b][c]].name) == 0)
{
//if the candidate is not eliminated
if (candidates[c].eliminated == false)
{
//+1 vote count to the candidate
candidates[c].votes++;
}
//if the candidate is eliminated
else
{
//skip to the next iteration of the loop and move on to the next preference of the voter
continue;
}
}
}
}
return;
}