diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-19 05:11:23 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-19 05:11:23 +0000 |
commit | ad9de15dd9a1af1638817692afcc2a445096d857 (patch) | |
tree | ff354cbdc4a0b3a08889f2b9b2d64317854fb6aa /wk3/pset/plurality | |
parent | 2ac3056bf2034b647068cc239ccbba1a6a3592fa (diff) |
Sun, Feb 18, 2024, 9:11 PM -08:00
Diffstat (limited to 'wk3/pset/plurality')
-rw-r--r-- | wk3/pset/plurality/plurality.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/wk3/pset/plurality/plurality.c b/wk3/pset/plurality/plurality.c index feaa103..d913f5c 100644 --- a/wk3/pset/plurality/plurality.c +++ b/wk3/pset/plurality/plurality.c @@ -81,6 +81,10 @@ void print_winner(void) { int winners[candidate_count]; winners[0] = 0; + for (int j = 1; j < candidate_count; j++) + { + winners[j] = -1; + } for (int i = 1; i < candidate_count; i++) { if (candidates[winners[0]].votes < candidates[i].votes) // if the new candidate has more votes than previous |