Question: BONUS Implement the method to count the difference types of players (Police, Villagers and Mayor). Return a new string vector with 3 numbers as a
BONUS
Implement the method to count the difference types of players (Police, Villagers and Mayor). Return a new string vector with 3 numbers as a string:
- First one should be the number of villagers.
- Second should be number of polices.
- Third should be number of mayors.
test result Player *c = new Chief("Harry", 61, 100, 5); Player *m = new Mayor("Bienve", 70, 100, 10); Player *p = new Police("Elvin", 60, 100, "ClerkPlace"); Player *v = new Villager("Alberto", 72, 100, "BlackSmithShop"); vectorlist{c, m, p, v}; vector playersCount = countTypesOfPlayersIn(list); cout << "Size: " << (playersCount.size()) << endl; cout << (playersCount.at(villagerIndex)) << endl; // EXPECTED 1 cout << (playersCount.at(policeIndex)) << endl; // EXPECTED 2 cout << (playersCount.at(mayorIndex)) << endl; // EXPECTED 1 Size: 3 1 2 1
#include "VillageB.cpp"
/* * BONUS: * * Implement the method to count the difference types of Players. * Return a new string array with 3 numbers as a string. * First one would be the number of Villagers. * Second would be number of Polices. * Third would be number of Mayors. * (Hint: Use the method to_string(...) to change from a int to a string) */
static vector
return vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
