C++ Soccer Scores. Write a program that stores the following data about a soccer
ID: 667862 • Letter: C
Question
C++
Soccer Scores. Write a program that stores the following data about a soccer player in a structure: Player’s name, Player’s number, Points scored by Player. The program should keep an array of 12 of these structures. Each element is for a different player on a team. The program should ask the user to enter information for each player. It should then display a table that lists each player’s number, name and points scored. The program should also calculate and display the total points earned by the team. The program should also determine which player earned the most points on the team and display that player’s information. Validation: Do not accept negative values for player’s number or points scored.
Program must have the following functions
void getPlayerInfo(Player &);
void showInfo(Player);
int getTotalPoints(Player [], int);
void showHighest(Player [], int);
The input and output should be formatted to look like the following screen shot except it should work for 12 players.
C:Windowslsystem32cmd.exe PLAYER #1 Player name: Richard Specioso Player' s number: 15 Points scored 23 PLAYER #2 Player name Joe Brown Player' s number: 23 Points scored 15 PLAYER #3 Player nameim Green Player' s number: 11 Points scored 27 NAME Richard Specioso 0e BFOWn NUMBER POINTS SCORED 15 23 23 15 27 Tim Gree 1mGreen TOTAL POINTS: 65 The player who scored the most points is: Tim Green Press anykey to continueExplanation / Answer
#include #include using namespace std; // Declaration of the Player structure struct Player { char name[45]; // Player's name int number; // Player's number int points; // Points scored by the player }; const int numPlayers = 12; // The number of players // Function prototypes void getPlayerInfo(Player &); void showInfo(Player); int getTotalPoints(Player [], int); void showHighest(Player [], int); //*********************************************** // Function main * //*********************************************** int main() { Player team[numPlayers]; int index; for (index = 0; index < 12; index++) { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.