From 1babf8a7891a57e72803e7e7c61fe5c2e1d7b226 Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:08:32 +0000 Subject: Mon, Feb 19, 2024, 2:08 PM -08:00 --- wk3/pset/runoff/runoff.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'wk3/pset/runoff/runoff.c') diff --git a/wk3/pset/runoff/runoff.c b/wk3/pset/runoff/runoff.c index a959a2c..0e05e15 100644 --- a/wk3/pset/runoff/runoff.c +++ b/wk3/pset/runoff/runoff.c @@ -146,16 +146,10 @@ void tabulate(void) // Query for each rank for (int j = 0; j < candidate_count; j++) { - for (int k = 0; k < candidate_count; k++) - { - if (!strcmp(preferences[i][j], candidates[k].name)) + if (!candidates[preferences[i][j]].eliminated) { - if (!candidates[k].eliminated) - { - candidates[k].votes++; - } + candidates[preferences[i][j]].votes++; } - } } } return; -- cgit v1.2.3