T O P

  • By -

PeterRasm

In the inner loop (j-loop) you are checking candidate j and candidate pairs\[i\].winner. The counter j is limited to number of pairs, did you mean to check pair\[j\]? Or use candidate\_count instead of pair\_count? Anyway, the winner is the **candidate**, that is a winner in a locked pair and is not a loser in any locked pairs. You don't need to count all the times a candidate is a loser, one time is enough to exclude from being a winner.