diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-19 21:43:05 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-19 21:43:05 +0000 |
commit | 8ae2f3a923a4a4b9c02daf665d9953a21191ccb2 (patch) | |
tree | 1826f3884655a61e462f1959eee4d48f12b0cdd2 /wk3/pset/runoff/runoff.c | |
parent | 115b88e4fd7e06afe5a969a9f2210f5629787f51 (diff) |
Mon, Feb 19, 2024, 1:43 PM -08:00
Diffstat (limited to 'wk3/pset/runoff/runoff.c')
-rw-r--r-- | wk3/pset/runoff/runoff.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/wk3/pset/runoff/runoff.c b/wk3/pset/runoff/runoff.c index e843f32..4d74680 100644 --- a/wk3/pset/runoff/runoff.c +++ b/wk3/pset/runoff/runoff.c @@ -164,23 +164,15 @@ void tabulate(void) // Print the winner of the election, if there is one bool print_winner(void) { - int f = 0; for (int i = 0; i < candidate_count; i++) { - if (candidates[i].votes >= (voter_count / 2)) + if (candidates[i].votes > (voter_count / 2)) { printf("%s", candidate.name); - f++; } } - if (f > 0) - { - return true; - } - else - { - return false; - } + return false; + } // Return the minimum number of votes any remaining candidate has |