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

Create a structure player_t to store the players name and their last three at ba

ID: 3647016 • Letter: C

Question

Create a structure player_t to store the players name and their last three at bats. You will create an array of this structure in the main function. Although the exact number of players is not known prior to entry, there will be no more than 10 at bats by a player in a single game. All data should be INPUT into array of structures before any calculations are done.

Excluding the "-----...", the output list should be similar to this:
-------------------------------------------------------------
Enter Name <Ctrl-Z to stop>: Juan Lopez
Enter the number of at bats for the last three games: 3 2 4

Enter Name <Ctrl-Z to stop>: Manny Smith
Enter the number of at bats for the last three games: 6 2 4

Enter Name <Ctrl-Z to stop>: ^Z


Name Games 1 Games 2 Game 3 Average
Juan Lopez 3 2 4 3.0

Manny Smith 6 2 4 4.0


The average number of at bats for the last three game is : 3.5
Press any key to continue...
-------------------------------------------------------------

I've been working on this for a week now, and I am having problem getting the program to work properly. I can't get the loop to store the values of the previous players and their respective scores when it comes time to display them. Also, I'm having problems terminating the loop with 'Ctrl-Z'. Please explain your method, it will help so much.

Explanation / Answer

This is not the exact solution . but it will help in solving above problem .ThanQ #include #define PLAYERS_NO 19 typedef struct { char name[20+1]; char lastName[25+1]; int atbat; int hits; int walks; int runs; float batavg; } Profile; int main(int argc, char** argv) { Profile stats[PLAYERS_NO]; int i; FILE* dataFile; int playerNo; Profile tmpProfile; int games = 0; for(i=0; i
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