Question 3 The electoral petition of 2021 was aimed at determining the winner of the 2020 election. The rule is that the
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Question 3 The electoral petition of 2021 was aimed at determining the winner of the 2020 election. The rule is that the
Question 3 The electoral petition of 2021 was aimed at determining the winner of the 2020 election. The rule is that the winner of an election in Ghana must obtain at least 50% +1 of the valid votes cast. 2 a. Explain the concept of function in C++ (AN 5) b. Declare a function called Greatest, your function should have five arguments i. The two names of the presidential candidates with the most votes ii. Total number of votes for each of them. iii. Total valid votes cast. (AN 7) c. Your function should declare the candidate that had at least 50%+1 of the valid votes cast as winner. (AN 8) d. Explain the logic behind the code(AN 5) [TOTAL 25] Question 4 a. Critically explain why you would consider the concept of using functions in your program again running a couple of if else statements. (AN 5) b. Declare a function with three arguments all of type int. The function should return the greatest of the three arguments, however if any two or all three are the same, you function should return that value [(AN 8) c. Embed you function in a complete program that requests for three variable all of type int and display the conditions explained in “b” above. (AN 7) d. Critically explain the logic behind the code [AN 5] [TOTAL 25]