Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that stores the following information of a soccer player in a st

ID: 3672008 • Letter: W

Question

Write a program that stores the following information of a soccer player in a structure. Players name (make it one string) Players number (make it an integer) Points scored by the player Use the text file below: write a function Player* file2Players(string filename.int &numPlayers;) that will read this file and returns the pointer pointing to the dynamically allocated array of structures of players. Also write a function that accepts two arguments - an array of structures of soccer players and size of the array and displays the player details in the array. void DisplayPlayers(Player *playerPtr, int numPlayers) Finally write a function that accepts two arguments -a pointer to the array of structure of soccer players and number of players. The function should sort the array of structure of soccer players based on descending order of scores of the players. After sorting, display the information of the sorted players. void sortPlayers(Plaver *playerPtr, int numPlayers)

Explanation / Answer

Below is the program you required: #include using namespace std; const int nameLength = 50; // array name length // declare the SoccerData structure struct SoccerData { char name[nameLength]; // Name array of the soccer player int number; // Number of the soccer player double points; // Points scored by soccer player double totalForTeam; // Total for the team double high; // For the highest points }; void getPlayerData(SoccerData &); // data for each player double totalPoints(SoccerData[], int); // total points double highestPoints(SoccerData[], int, int &); // player with highest score void showTeam(SoccerData[], int); // shows information about the team void main() { // Constant for the number of months // used 3 for testing 12 is the number of players for the problem const int numPlayers = 3; // Array of SoccerData structures SoccerData team[numPlayers]; // Variables int highestPlayer; // the player with the hightest score // ask for the player information for each player on the team cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote