Question: Use the map in C++ STL, Create a class named Team. And then create the definition of the class Team in a file team.h and
Use the map in C++ STL,
Create a class named Team. And then create the definition of the class Team in a file team.h and the functions for Team in team.cpp. At last, create a main program in a file named teammain.cpp.
Use map.
Dynamically allocate an array of 5 teams.
Prompt the user input the information about each of the 5 teams and store the information in one of the array elements.
Print the information for each Team.
Clean up all allocated space.
The requirement of the class :
Accessors for all attributes
Mutators for all attributes
A default constructor that sets all data elements to 0 or blank text as appropriate
A fully specified constructor that allows defining values for all attributes
A printinfo method that will display all the info for a team in a logical and well formatted way including labels for each of the attribute fields
#include
using namespace std;
class Team
{
private:
string TeamName;
int NumberofPeople;
string Leader;
public:
Team();
Team(string TeamName, int NumberofPeople, string Leader);
~Team();
void setTeamName(string teamname);
void setNumberofPeople(int num);
void setLeader(string leader);
string getTeamName();
float gettNumberofPeople();
string getLeader();
void printInfo();
};
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
