Question
Write a program that stores the following data about a soccer player in a structure: Players Name Players Number Points Scored by a Player Your
Write a program that stores the following data about a soccer player in a structure:
Players Name
Players Number
Points Scored by a Player
Your program should keep an array of 3 of these structures. Each array element stores data for a different player on the team. The data will be read from a file into an array of structs and then output. The program should then calculate and display the total points earned by the team. Finally, output the name of the player who has earned the most points and his points. Please follow the directions listed below regarding the functions you need.
Your program should have the following functions:
- getData will read the data from inFile.txt and store the data in the array of structs.
inFile.txt will look like this:
JohnSmith
123 3
PaulJones
111 7
EdSmall
-90 7
Joe_hmoe
333 5
TomJones
444 -9
- printData will output the data to file outFile.txt in a table using the following format
Name Number Points
XXXXX XXX XX
- calcTeamPoints will calculate and output to the file the total team points
- findHigh will determine and output to the file the name of the player with the highest points and the highest points. The signature for this function must look like:
void showHighest(Player *p, int size)
Input Validation Do not accept negative values for players numbers or points scored. This data will not be added to the array. Invalid messages need to be output to the file with the name of the player and the invalid data (number or points).
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