diff options
-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; |