A sports team plays games at home and away. Write a program to keep track of a team’s win/loss record at home, away, and their total. Use nested structures as you develop this program.
a. Define a Win Loss structure with wins and losses members (int).
b .Define a Team structure with the team name, containing a Win Loss structure variable for total wins/losses, a Win Loss structure variable for home wins/losses, and a Win Loss structure variable for away wins/losses.
c. Declare an array of type Team.
2.Build a menu-driven program with these options:
a. Enter a new team
b .Display all teams
c .Display a particular team
d.Exit the program
3.Define these functions according to these prototypes:
Shows the menu
Gets the user selection
Validates the menu selection
Returns a valid menu selection
b. Win Loss getWinLoss(string);
Gets wins and losses from the keyboard for the location indicated by the string parameter (“home” or “away”) and returns a Win Loss structure containing the input.
c. void displayWinLoss(WinLoss);
Displays a string containing the win and loss members in the format of “wins-losses”.
d .Team getTeam();
Inputs the team name
Inputs home wins and losses using get Win Loss()
Inputs away wins and losses using get Win Loss()
Stores the home wins/losses in the appropriate team structure
Stores the away wins/losses in the appropriate team structure
Calculates the total wins/losses and stores those in the appropriate structure
Returns all of this in a single Team structure
e .void display Team(Team);
Displays the team name, total wins and losses, home wins and losses, and away wins and losses. Use the display Win Loss function described above.
f .void find Team(Team, int);
Prompt the user for the team name
Search the array for a match
If there is a match, display the team information using the display Team function described above.
If there is no match, display an error message.