Advertisement
Guest User

Untitled

a guest
May 8th, 2020
2,250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  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 (check_winner(i))
  7.         {
  8.             printf("%s\n", candidates[i]);
  9.             break;
  10.         }
  11.    
  12.     }
  13.     return;
  14. }
  15.  
  16. bool check_winner(int winner)
  17. {
  18.     for (int j = 0; j < candidate_count; j++)
  19.     {
  20.         if (locked[j][winner])
  21.         {
  22.             return false;
  23.         }
  24.     }
  25.     return true;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement