Use a member initialization list to make the TeamInfo constructor initialize the vector listOfPointsInSeason with a size of 6. Note: Including a vector in an initialization list causes that vector's constructor to be called with the value in the parens.
#include #include using namespace std;class TeamInfo { public: TeamInfo(); void PrintGamesInSeason() const; private: vector listOfPointsInSeason;};TeamInfo::TeamInfo() : /* Your code goes here */ {}void TeamInfo::PrintGamesInSeason() const { cout < "there="" are="" "="">< listofpointsinseason.size()="">< "="" games="" in="" a="" season."=""><>}int main() { TeamInfo myTeam; myTeam.PrintGamesInSeason(); return 0;}Extracted text: zy Section 4.12 - CIS 22B: Intermedi x + i learn.zybooks.com/zybook/DEANZACIS22BNguyenFall2021/chapter/4/section/12 vu = zyBookS My library > CIS 22B: Intermediate Programming Methodologies in C++ home > 4.12: Constructor initializer lists zyBooks catalog ? Help/FAQ Uy Vu Lam 351182.2261528.qx3zqy7 Jump to level 1 1 Use a member initialization list to make the Teamlnfo constructor initialize the vector listOfPointsInSeason with a size of 6. Note: Including a vector in an initialization list causes that vector's constructor to be called with the value in the parens. 1 #include 2 #include 3 using namespace std; 4 5 class TeamInfo { public: TeamInfo(); void PrintGamesInSeason() const; 6. 7 8 9 private: vector list0fPointsInSeason; 10 11 12 }; 13 14 TeamInfo::TeamInfo() : /* Your code goes here */ { 15 } 16 17 void TeamInfo::PrintGamesInSeason() const { 18 cout <« "there="" are="" "="">«><« listofpointsinseason.size()="">«><« "="" games="" in="" a="" season."="">«>< endl; 19 } 20 21 int main() { 22 teaminfo myteam; 23 24 myteam. printgamesinseason(); 25 26 return 0; 27 } check next * endl;="" 19="" }="" 20="" 21="" int="" main()="" {="" 22="" teaminfo="" myteam;="" 23="" 24="" myteam.="" printgamesinseason();="" 25="" 26="" return="" 0;="" 27="" }="" check="" next=""> endl; 19 } 20 21 int main() { 22 teaminfo myteam; 23 24 myteam. printgamesinseason(); 25 26 return 0; 27 } check next *>
class TeamInfo { public: TeamInfo(); void PrintGamesInSeason() const;
private: vector listOfPointsInSeason;};TeamInfo::TeamInfo() : /* Your code goes here */ {}void TeamInfo::PrintGamesInSeason() const { cout < "there="" are="" "="">< listofpointsinseason.size()="">< "="" games="" in="" a="" season."=""><>}int main() { TeamInfo myTeam; myTeam.PrintGamesInSeason(); return 0;}Extracted text: zy Section 4.12 - CIS 22B: Intermedi x + i learn.zybooks.com/zybook/DEANZACIS22BNguyenFall2021/chapter/4/section/12 vu = zyBookS My library > CIS 22B: Intermediate Programming Methodologies in C++ home > 4.12: Constructor initializer lists zyBooks catalog ? Help/FAQ Uy Vu Lam 351182.2261528.qx3zqy7 Jump to level 1 1 Use a member initialization list to make the Teamlnfo constructor initialize the vector listOfPointsInSeason with a size of 6. Note: Including a vector in an initialization list causes that vector's constructor to be called with the value in the parens. 1 #include 2 #include 3 using namespace std; 4 5 class TeamInfo { public: TeamInfo(); void PrintGamesInSeason() const; 6. 7 8 9 private: vector list0fPointsInSeason; 10 11 12 }; 13 14 TeamInfo::TeamInfo() : /* Your code goes here */ { 15 } 16 17 void TeamInfo::PrintGamesInSeason() const { 18 cout <« "there="" are="" "="">«><« listofpointsinseason.size()="">«><« "="" games="" in="" a="" season."="">«>< endl; 19 } 20 21 int main() { 22 teaminfo myteam; 23 24 myteam. printgamesinseason(); 25 26 return 0; 27 } check next * endl;="" 19="" }="" 20="" 21="" int="" main()="" {="" 22="" teaminfo="" myteam;="" 23="" 24="" myteam.="" printgamesinseason();="" 25="" 26="" return="" 0;="" 27="" }="" check="" next=""> endl; 19 } 20 21 int main() { 22 teaminfo myteam; 23 24 myteam. printgamesinseason(); 25 26 return 0; 27 } check next *>
TeamInfo::TeamInfo() : /* Your code goes here */ {}
void TeamInfo::PrintGamesInSeason() const { cout < "there="" are="" "="">< listofpointsinseason.size()="">< "="" games="" in="" a="" season."=""><>}
int main() { TeamInfo myTeam;
myTeam.PrintGamesInSeason();
return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here