Guest User

Untitled

a guest
May 8th, 2020
254
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Print the winner of the election
  2. void print_winner(void)
  3. {
  4.     for (int i = 0; i < candidate_count; i++)
  5.     {
  6.         if (locked[pairs[i].winner][pairs[i].loser])
  7.         {
  8.             if (check_winner(pairs[i].winner))
  9.             {
  10.                 printf("%s\n", candidates[pairs[i].winner]);
  11.                 break;
  12.             }
  13.         }
  14.     }
  15.     return;
  16. }
  17.  
  18. bool check_winner(int winner)
  19. {
  20.     for (int j = 0; j < candidate_count; j++)
  21.     {
  22.         if (locked[j][winner])
  23.         {
  24.             return false;
  25.         }
  26.     }
  27.     return true;
  28. }
RAW Paste Data