Question: Purpose: To declare, define and call functions and to declare and use an array of structs using the typedef statement. Problem: In many athletic competitions,
Purpose: To declare, define and call functions and to declare and use an array of structs using the typedef statement.
Problem: In many athletic competitions, athletes compete in several events and receive a score for each. These scores are then combined into a single result.
Your job is to write a program that calculates the results of MANY competitors
competing for the Athlete of the Year award. ALL athletes compete and receive a
score in five events: Diving GymnasticsSkatingBoxing and Power
Posing Their total is computed to determine the winner.
Method: For each contestant, you will
Read in the contestant number and hisher scores in each event.
Print out the contestant number, the score for each event, and the TOTAL
number of points the athlete accumulated add the five scores together
At the end, you should
Compare all the athletes scores to identify the winner of the Athlete of the
Year award and display that contestant number AND their total score.
Input: Each athletes scores are grouped together in the input file, but unfortunately do not appear in any fixed order the score keepers got the score sheets out of order
Therefore, you will have to read in the event name D G B S or P BEFORE you
know which event to update. The set of scores for each athlete are separated from
one another by the contestant number ie there is a line with an integer contestant number followed by lines of event and score, that is B The end of the input file is signaled by a sentinel value Use this value to control your looping. You will fetch the input from a file called CSprogtxt This file is already created and will be emailed to you. The input file looks similar to the following but has more data:
G
P
S
D
B
P
G
D
S
B
:
Output: Output both contestants numbers, the scores for each event, the resulting TOTAL
points accumulated.
Output the winner by printing the contestant number and hisher TOTAL score.
SAMPLE:
Contestant:
Diving:
Gymnastics:
Boxing:
Skating:
Posing:
TOTAL:
:
Contestant:
Diving:
ATHLETE OF THE YEAR: Contestant with TOTAL of
Requirements:
Use the struct you declare and define for Athlete.
Add functions as you see fit. You will be graded on your decisions. You must add a
function to GetContestants that returns the entire array by reference. You must add a function to DisplayAllContestants that receives the entire array. Then call the other
functions you wrote in them to get the input or display the output.
Label all output and format it neatly and clearly. Print appropriate messages as well.
Remember to comment and format your program as well.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
