nonipal

Untitled

Jul 15th, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. bool print_winner(void)
  2. {
  3.     // TODO
  4.    
  5.     printf("a:%i b:%i c:%i \n", candidates[1].votes, candidates[2].votes, candidates[3].votes);           //Testing
  6.  
  7.  
  8.     for (int i = 0; i < voter_count; i++)
  9.     {
  10.         if (candidates[i].votes >= voter_count / 2)
  11.         {
  12.             printf("%s \n", candidates[i].name);
  13.            
  14.             return true;
  15.         }
  16.     }
  17.     return false;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment