From 9f5587f069d0a40c35bf5652ee42b71168daf7ce Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Mon, 19 Feb 2024 02:52:51 +0000 Subject: Sun, Feb 18, 2024, 6:52 PM -08:00 --- wk3/pset/plurality/plurality.c | 11 +++++++++-- 1 file 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; -- cgit v1.2.3