From 50d45a9c09454c2024af891ecd7e22609e919748 Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:36:58 +0000 Subject: Mon, Feb 19, 2024, 12:36 PM -08:00 --- wk3/pset/runoff/runoff.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'wk3/pset') diff --git a/wk3/pset/runoff/runoff.c b/wk3/pset/runoff/runoff.c index 2d421f3..66439ac 100644 --- a/wk3/pset/runoff/runoff.c +++ b/wk3/pset/runoff/runoff.c @@ -164,38 +164,7 @@ void tabulate(void) // Print the winner of the election, if there is one bool print_winner(void) { - int losers[candidate_count]; - losers[0] = 0; - // reset it - for (int j = 1; j < candidate_count; j++) - { - losers[j] = -1; - } - // goes through every candidate, looks at votes, eliminates the least voted - for (int i = 1; i < candidate_count; i++) - { - if (candidates[losers[0]].votes > candidates[i].votes) // if the new candidate has more votes than previous - { - // clear the list of winners - for (int j = 1; j < candidate_count; j++) - { - losers[j] = -1; - } - // put it at the start of the new list - losers[0] = i; - } - else if (candidates[losers[0]].votes == candidates[i].votes) - { - for (int j = 1; j < candidate_count; j++) - { - if (losers[j] == -1) - { - losers[j] = j; - break; - } - } - } - } + return false; } -- cgit v1.2.3