SHARE
TWEET

plurality functions

decs4usa Jan 23rd, 2020 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Update vote totals given a new vote
  2. bool vote(string name)
  3. {
  4.     for (int i = 0; i > MAX; i++)
  5.     {
  6.         if (strcmp(candidates[i].name == 0))
  7.  
  8.         return 1 + candidates[i].votes;
  9.         return true;
  10.  
  11.         else
  12.  
  13.         return false;
  14.     }
  15. }
  16.  
  17. // Print the winner (or winners) of the election
  18. void print_winner(void)
  19. {
  20.     int voter_count(int candidates[i].votes)
  21.     {
  22.         int i, voter_count = 0;
  23.         for (i = 0; i < n; i ++)
  24.         {
  25.             if candidates[i].votes >= voter_count)
  26.             voter_count = candidates[i].votes;
  27.             candidates[i].votes = candidates[i].names;
  28.         }
  29.         printf("%s\n", candidates[i].names);
  30.         return 0;
  31.     }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top