when I try my code manually it does everything correct, but when I run Check 50, it says following ":( print_winner identifies Alice as winner of election print_winner function did not print winner of election"
// Get the highest scores
// Print votes
int i = candidate_count - 1;
while (candidates[i].votes == candidates[i + 1].votes);
Where it says merge_sort is just a code for sorting being the highest number of the array the highest amount of votes.
Thanks in advance for any help
I am not sure which version of voting you are implementing.
Having the highest number of votes is not enough to be considered a winner (at least in the runoff version).
The winner needs to have more than half of all votes.
will have candidates[i].votes > (voter_count / 2)
Also be careful with sorting the array - it looks like you might be modifying the original candidates array, which potentially may lead to some problems. Perhaps sort a copy of that array to make sure you preserve the original one?