c++ The program reads data about two contestants from the keyboard and displays the scores and the winner of the two contestants. The program uses a data structure called Contestant for storing the scores of a contestant and a set of functions related to the data structure for processing the scores of contestants. The data structure, Contestant, contains an int variable for the contestant's ID and an array of doubles for the scores given to the contestant. Each ID must be a positive integer. Each score must fall in the range from 0.0 to 10.0 inclusive. Your job is to complete the program so that its output matches the expected outputs when testing with the same test data. First, complete everything that is required of you at the top of the file. Then complete those and only those incomplete functions according to their descriptions. Each of the incomplete functions has the following line in its body. // Write your code with comments . . . Remove that line and complete the function. Make sure your code has comment lines inserted properly like those shown in the completed functions. The main function has already been completed and should not be modified. It defines two Contestant variables, calls the readContestant function for each of the variables so that the variables are loaded with the data. If the first call returns false, issue the error message as follows, First contestant's data invalid. If the second call returns false, issue the error message as follows, Second contestant's data invalid. If both calls return true, it makes the following calls and prints the final result. Call printHeading to print the heading. Call printScores to print the first contestant's data. Call printScores to print the second contestant's data. Call compareContestants to determine the winner. Print the result of the contest. The output format is shown below. If the input from the keyboard is
c++
The program reads data about two contestants from the keyboard and displays the scores and the winner of the two contestants. The program uses a data structure called Contestant for storing the scores of a contestant and a set of functions related to the data structure for processing the scores of contestants. The data structure, Contestant, contains an int variable for the contestant's ID and an array of doubles for the scores given to the contestant. Each ID must be a positive integer. Each score must fall in the range from 0.0 to 10.0 inclusive.
Your job is to complete the program so that its output matches the expected outputs when testing with the same test data.
First, complete everything that is required of you at the top of the file. Then complete those and only those incomplete functions according to their descriptions. Each of the incomplete functions has the following line in its body.
// Write your code with comments . . .
Remove that line and complete the function. Make sure your code has comment lines inserted properly like those shown in the completed functions.
The main function has already been completed and should not be modified. It defines two Contestant variables, calls the readContestant function for each of the variables so that the variables are loaded with the data.
If the first call returns false, issue the error message as follows,
First contestant's data invalid.
If the second call returns false, issue the error message as follows,
Second contestant's data invalid.
If both calls return true, it makes the following calls and prints the final result.
Call printHeading to print the heading.
Call printScores to print the first contestant's data.
Call printScores to print the second contestant's data.
Call compareContestants to determine the winner.
Print the result of the contest.
The output format is shown below.
If the input from the keyboard is
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 8 images