diff options
Diffstat (limited to 'wk3/pset/runoff/runoff.c')
-rw-r--r-- | wk3/pset/runoff/runoff.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/wk3/pset/runoff/runoff.c b/wk3/pset/runoff/runoff.c index f7fbcfa..9ff4d19 100644 --- a/wk3/pset/runoff/runoff.c +++ b/wk3/pset/runoff/runoff.c @@ -187,16 +187,18 @@ int find_min(void) // look through all candidates for (int i = 0; i < candidate_count; i++) { - // if the new candidate has less votes than previous - if (candidates[i].votes < candidates[dead[0]].votes) - { - // clear the list of dead - for (int j = 1; j < candidate_count; j++) + if (!candidates[i].eliminated) { + // if the new candidate has less votes than previous + if (candidates[i].votes < candidates[dead[0]].votes) { - dead[j] = -1; + // clear the list of dead + for (int j = 1; j < candidate_count; j++) + { + dead[j] = -1; + } + // put it at the start of the new list + dead[0] = i; } - // put it at the start of the new list - dead[0] = i; } } return candidates[dead[0]].votes; |