Question: please can you solve this C++ question A tele match event has been held in Sekolah Rendah Tebing Tinggi. Three teams are allowed to participate


A tele match event has been held in Sekolah Rendah Tebing Tinggi. Three teams are allowed to participate in this match, with each team consisting of four participants. Five (5) events were contested, namely E1, E2, E3, E4 and ES. Table 1 shows the scores that have been collected by cach team for the five events. Team Id 1 E3 8 10 10 8 10 7 E4 10 7 6 7 Table 1: Collected scores Participant Id E2 1001 10 5 1002 8 7 1003 7 10 1004 10 10 2001 7 8 2002 10 8 2003 8 6 2004 7 8 3001 10 3002 8 7 3003 7 8 3004 8 6 9 8 ES 6 9 10 7 10 10 10 8 10 8 6 7 2 2 8 8 10 8 8 10 8 10 7 3 9 8 Write a C++ program which can assist the tele match committee to determine the winner for these events. Your program should be able to do the following tasks: (a) The program will read input data: team id, participant id and scores for the five events namely E1, E2, E3, E4 and Es from an input file named "input2.txt" into an array marks [12] 7] of type int. Example of the series of input data in input file is shown in Figure 1. (b) The program must be able to notify the user if the input file cannot be opened (failed to open) with proper prompt. The example for user notification where the file fails to open is shown in Figure 2. (c) Calculate the total score for each participant. (d) Calculate the total score for each team. (e) Besides the function main(), the program needs to define three (3) other functions as described in Table 2. Use appropriate argument (if necessary) for each function. (1) The program needs to print out the following information. Figure 3 shows the example, run of the successful program. i. The team id. ii. The participant id. iii. The scores for the five events, E1, E2, E3, E4 and E5 for each participant. LMY 2021 V. iv. The total score for each participant. The total score for each team. vi. The winner for individual category (selected based on highest total score that collected by the participants). vii. The winner for group category (selected based on highest total score that collected by the teams). 1 1001 10 5 8 10 6 1 1002 8 7 10 79 1 1003 7 10 10 6 10 1 1004 10 10 8 77 2 2001 7 8 10 9 10 2 2002 10 8 7 8 10 2 2003 8 6 8 8 10 2 2004 7 8 8 8 8 3 3001 10 9 10 10 10 3 3002 8 7 8 8 8 3 3003 7 8 9 10 6 3 3004 8 687 Figure 1: Input file named "input2.txt" Sorry, input file not exist! Press any key to continue Figure 2: Example user notification in case file fails to open Table 2: Description for functions Function Description displayLine() To display lines using the 52 characters of the function should use loop to display the line. findIndWinner() To determine the winner for individual category (selected based on the highest total score that was collected by participants). The function should accept the array for a total score of each participant as one of its argument. findTeamwinner () To determine the winner of group category (selected based on the highest total score that was collected by teams). The function should accept the array for a total score for each team as one of its argument. Id GI G2 G3 G4 G5 Total TEAM 1 1001 1002 1003 1004 TOTAL 10 8 7 10 5 7 10 10 8 10 10 8 10 7 6 7 6 9 10 7 39 41 43 42 165 7 8 44 10 TEAM 2 2001 2002 2003 2004 TOTAL 10 7 8 8 9 8 8 8 10 10 10 8 8 7 6 8 40 39 166 TEAM 3 3001 3002 3003 3004 TOTAL 10 8 7 8 9 7 8 10 8 9 8 10 8 10 7 10 8 6 7 49 39 40 36 164 Winner for Individual Category: 3001 (Team 3) Winner for Group Category: Team 2 (Score - 166) Press any key to continue... Figure 3: Example run of the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
