0

My print winner function works and prints the correct winner. I might be overlooking something simple, but I have no idea what it could be.


bool print_winner(void) { // TODO for (int i = 0; i < candidate_count; i++) { if (candidates[i].votes * 2 > voter_count) { printf("%s \n", candidates[i].name); return true; } } return false; }


I keep getting these two errors:

:( print_winner prints name when someone has a majority print_winner did not print winner of election :( print_winner returns true when someone has a majority print_winner did not print winner and then return true

Any help would be greatly appreciated, thank you.

3

check50 looks for an exact match of the candidate name. This printf format string "%s \n" "adds a little something".

| improve this answer | |
  • Yeah, I can't believe I overlooked that. Thank you very much for your answer, you are a champion of the people! :) – Laser Media Feb 2 at 0:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .