Question: Working in C++ This program will allow the user to see a list of teams, add a team to the list, or search for a

Working in C++

Working in C++ This program will allow the user to see a

list of teams, add a team to the list, or search for

This program will allow the user to see a list of teams, add a team to the list, or search for a team using an ID 1. Structure Definition First define struct Teams with an integer field to hold an ID, and an array of strings with three elements to hold the names of the team members. In the main function, declare an empty vector of TeamV and also the following arrays: conat int ID [NUM TEAMS -1123, 321, 456, 789) const string MEMBERS (NUM TEAMS] [UM MEMBERS "Sally", "Joe", "John", "Chris", "Kevin","Jams") "Tom","Kim", "Emily") "Ji11", "Jacob", "Jim") 2. Creating the vector Call a function with the following prototype and pass in the empty vector and the arrays: void Initialize (vector &Teamv, const int id The function should place into the vector the elements of the arrays. const string mUM MEMBERS], int arraySize) For example, the first element of the vector will have team id: 123 and members: Sarah, Joe, and John. The second element of the vector will have team id: 321 and members: Chris, Kevin, and James, and so on 3. The print function Back in main, call a function with the following prototype to show that your vector has been populated with the team information: void printList (const vector &Team) The function simply prints out the content of the vector. Make sure that the output is neatly formatted. 4. The menu Function Next, place a loop in your main function such that in each iteration the user sees a menu and has the chance to enter a choice. Call a function with the following prototype to display the menu: void menu ) If the users selects option 1, call the printList function to display the list. 5. Adding to a vector If the user selects option 2, call a function with the following protoype which will allow the user to enter the information for a team which will be added to your team vector void add (vector &TeamV) 6. Searching a Vector If the user selects option 3, ask for the ID the user wants to search for and call a function with the following protoype which will perform a search on your vector and return the index of the element with the matching ID or -1 if no match is found: int search (const vector & TeamV, int id): Make sure that this function performs a linear search. 7. Displaying a selected vector entry In the search function, printout the information of the team with the matching ID In main, use the return value of the function to determine if an error message is to be displayed if no matching ID is found. If so, display "no such team" to the user 8. Ending the program If the user selects option 4, stop the program. Display the following message Lab 2 written by XXXXXX has ended. Where XXXXXX is vour First and Last name

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!