*/ #include // Global content const int MAX_PARTIES = 2; int party1 = 0; char party1Name[] = "SeaWeed"; int pa
Posted: Thu Jul 14, 2022 2:18 pm
*/#include <stdio.h>// Global contentconst int MAX_PARTIES = 2;int party1 = 0;char party1Name[] = "SeaWeed";int party2 = 0;char party2Name[] = "Aqua";// Function ProtoTypes - Needed for Array of Functionsvoid voteParty1();void voteParty2();void (*partyList[MAX_PARTIES])() = { voteParty1,voteParty2 };// Function Definitionsvoid voteParty2() {party2++;printf("Thank you for voting for the %sParty.\n",party1Name);}void voteParty1() {party1 = party1++; // Bad Syntax supported by Microsoftprintf("Your vote for the %s Party is muchappreciated.\n",party2Name);}void results() {printf("\n%s party has %d vote(s). \n", party1Name, party1);printf("%s party has %d vote(s). \n", party2Name, party2);}//TODO Create the countTYourVote method here/**Main processing*/int main(){
unsigned int choice;while (true) {printf("Enter 1 for %s party\n",party1Name);printf("Enter 2 for %s party\n",party2Name);puts("Enter 0 to Exit");printf("Enter Choice:");scanf("%d",&choice);if (choice > MAX_PARTIES) {continue;}if (choice == 0) {break;}--choice; // adjust index for alignmentcountYourVote(partyList[choice]);}results();}
The included program counts votes but isincomplete. Complete the included program. It needs thefollowing:
unsigned int choice;while (true) {printf("Enter 1 for %s party\n",party1Name);printf("Enter 2 for %s party\n",party2Name);puts("Enter 0 to Exit");printf("Enter Choice:");scanf("%d",&choice);if (choice > MAX_PARTIES) {continue;}if (choice == 0) {break;}--choice; // adjust index for alignmentcountYourVote(partyList[choice]);}results();}
The included program counts votes but isincomplete. Complete the included program. It needs thefollowing: