Suppose the South African Football Association (SAFA) runs a competition in which a spectator has to be chosen from three candidates and suppose there are 4 voting stations. We need a C++ program that will count the votes for every candidate and display the result. At every voting station the voters have to be asked one after the other for which candidate (indicated by (C)hiefs or (B)uccaneer or (P)latinum Stars) he or she wants to vote for. ZZZ is entered when all the voters at the specific voting station have voted. The program has the following structure • The three totals and the number of spoilt votes are initialised to 0 • Now a for loop follows, going from one (1) to the number of voting stations • Inside the loop is a while loop. A prompting message appears on the screen, asking the voter for which candidate he or she wants to vote. The choice of the voter is then input • Inside the while loop is a switch statement to increment the correct total. The default option is used to count the number of spoilt votes • The while loop is exited when ZZZ is entered for the choice • When the for loop is exited, the three totals, the number of spoilt votes and the winning total are displayed
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment