diff options
Diffstat (limited to 'wk3')
-rw-r--r-- | wk3/pset/runoff/runoff.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/wk3/pset/runoff/runoff.c b/wk3/pset/runoff/runoff.c index 3d3152e..f8a17fd 100644 --- a/wk3/pset/runoff/runoff.c +++ b/wk3/pset/runoff/runoff.c @@ -127,7 +127,14 @@ int main(int argc, string argv[]) // Record preference if vote is valid bool vote(int voter, int rank, string name) { - // TODO + for (int i = 0; i < candidate_count; i++) + { + if (!strcmp(name, candidates[i].name)) + { + preferences[voter][rank] = candidates[i].name; + return true; + } + } return false; } |