diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-19 02:52:51 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-19 02:52:51 +0000 |
commit | 9f5587f069d0a40c35bf5652ee42b71168daf7ce (patch) | |
tree | 28c58228da6a7a560352d1dc4758527a4a9c9ae5 /wk3/pset/plurality | |
parent | b54175ba9acbd2b6f041dda6932b83f4a547bc99 (diff) |
Sun, Feb 18, 2024, 6:52 PM -08:00
Diffstat (limited to 'wk3/pset/plurality')
-rw-r--r-- | wk3/pset/plurality/plurality.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/wk3/pset/plurality/plurality.c b/wk3/pset/plurality/plurality.c index c8db427..d39779f 100644 --- a/wk3/pset/plurality/plurality.c +++ b/wk3/pset/plurality/plurality.c @@ -92,8 +92,15 @@ void print_winner(void) } //put it at the start of the new list winners[0] = candidates[i].name; - } else if (winners[0] == candidates[i].name) { - for (int j = 1;j < candidate_count - 1; j++) + } else if (winners[0] == candidates[i].name) + { + for (int j = 1; j < candidate_count - 1; j++) + { + if (winners[j] == 0) + { + winners[j] == candidates[i].name; + } + } } } return; |