Question
Write in C++ program, Write a program that declares a struct to store the data of a football player (players name, players position, number of
Write in C++ program,
Write a program that declares a struct to store the data of a football player (players name, players position, number of touchdowns, number of catches, number of passing yards, number of receiving yards, and the number of rushing yards).
Declare an array of 10 components to store the data of 10 football players.
Your program must contain a function to input data and a function to output data. Add functions to search the array to find the index of a specific player, and up-date the data of a player. (You may assume that the input data is stored in a file.) Before the program terminates, give the user the option to save data in a file. Your program should be menu driven, giving the user various choices.
An example of the program is shown below:
Select one of the following options: 1: To print a player's data 2: To print the entire data 3: To update a player's touch downs 4: To update a player's number of catches 5: To update a player's passing yards 6: To update a player's receiving yards 7: To update a player's rushing yards 99: To quit the program 1 Enter player's name: Bill Name: BillPosition: Quarter_Back; Touch Downs: 70; Number of Catche s: 0; Passing Yards: 8754; Receiving Yards: 0; Rushing Yards: 573 Select one of the following options: 1: To print a player's data 2: To print the entire data 3: To update a player's touch downs 4: To update a player's number of catches 5: To update a player's passing yards 6: To update a player's receiving yards 7: To update a player's rushing yards 99: To quit the program 99 Would you like to save data: (y,Y/n,N)
////////////////////////////////////////////////////
Text file: Ch9_Ex7Data.txt
Bill Quarter_Back 70 0 8754 0 573 Jackson Receiver 55 87 50 5490 574 Grahm Running_Back 45 30 0 50 2800 McCoy Full_Back 25 10 0 25 3762 Daryl Quarter_Back 50 2 7560 0 450 Santiago Left_Tackle 5 0 0 0 0 Hanks Receiver 35 37 0 3590 876 Johnson Running_Back 25 80 0 100 4000 Miller Receiver 110 250 150 7867 2100 Ruth Quarter_Back 85 0 12901 0 3249 /////////////////////////////////////////////////
Test Cases (1):
Input Data:
3 Daryl 2 1 Daryl 99 N
Output Result - Touch Downs: 52
Test Case (2):
Input:
6 Ruth 13 99 Y
Output Result: Searched your code for a specific pattern:
(Ruth Quarter_Back 85 0 12901 13 3249)
Test Case (3):
Input:
1 Jackson 99 N
Output Result:
Touch Downs: 55
Number of Catches: 87
Passing Yards: 50
Receiving Yards: 5490
Rushing Yards: 574
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