Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A telematch event has been held in Sekolah Rendah Tebing Tinggi. Three teams are allowed to participate in this match, with each team consisting of
A telematch 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 E5. Table 1 shows the scores that have been collected by each team for the five events. Write a C++ program that can assist the telematch 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 E5 from an input file named "input.txt" into an array marks [12] [7] of type int. An example of the series of input data in the 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 the 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. Dr Eiliyah Wong 1 \begin{tabular}{|llllllllll} 1 & 1001 & 10 & 5 & 8 & 10 & 6 \\ 1 & 1002 & 8 & 7 & 10 & 7 & 9 \\ 1 & 1003 & 7 & 10 & 10 & 6 & 10 \\ 1 & 1004 & 10 & 10 & 8 & 7 & 7 \\ 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 & 6 & 8 & 7 \end{tabular} Figure 1: Input file named "input. txt" Sorry, input file does not exist! Press any key to continue. . . Figure 2: Example user notification in case file fails to open 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. 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. Dr Eiliyah Wong f) The program needs to print out the following information. Figure 3 shows the example, run of the successful program. - The team ID. - The participant ID. - The scores for the five events, E1, E2, E3, E4 and E5 for each participant. - The total score for each participant. - The total score for each team. - The winner for individual category (selected based on highest total score that collected by the participants). - The winner for group category (selected based on highest total score that collected by the teams). Figure 3: Output of the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started