Question
C++ language. Working on this assignment and I am getting stuck after the user enters in a menu choice. Trying to make my functions but
C++ language. Working on this assignment and I am getting stuck after the user enters in a menu choice. Trying to make my functions but I am having trouble with the functions. Not sure how to enter in a new team and their wins and losses. Any advice or examples will be appreciated. C++ language. CIS 1202 Programming Assignment #6 Structured Data 1 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. Requirements 1. Data structures: a. Define a WinLoss structure with wins and losses members (int). b. Define a Team structure with the team name, containing a WinLoss structure variable for total wins/losses, a WinLoss structure variable for home wins/losses, and a WinLoss 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: a. int menu(); Shows the menu Gets the user selection Validates the menu selection Returns a valid menu selection
b. WinLoss getWinLoss(string); Gets wins and losses from the keyboard for the location indicated by the string parameter ("home" or "away") and returns a WinLoss 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 getWinLoss() Inputs away wins and losses using getWinLoss() 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 displayTeam(Team); Displays the team name, total wins and losses, home wins and losses, and away wins and losses. Use the displayWinLoss function described above. f. void findTeam(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 displayTeam function described above. If there is no match, display an error message. 4. Functions must pass parameters and return values as needed, using only local variables. Global variables are not allowed. 5. Create any other functions or variables as you see fit.
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