Question: in C++, how would I call this method that I wrote to my main .cpp file to remove all of my heroes from the data

in C++, how would I call this method that I wrote to my main .cpp file to remove all of my heroes from the data base? I am confused on if I need to add the counter and everything, and the correct syntax for calling to my method I have created. **disclaimer the code I am sharing here is my code and I wrote it myself, just trying to call my method in main.**

 

void HeroesDB::RemoveAllHeroes(std::string Squad, std::vector Superb)
{
int counter = 0;
std::vector Superb;
for (Hero NumberOne : _heroes) {
 int Compare = isPrefix(Squad.c_str(), NumberOne.Name().c_str());
 if (Compare == 0)
 {
  Superb.push_back(NumberOne);
  _heroes.erase(_heroes.begin() +counter);
 }
 counter++;
}
}


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To call the RemoveAllHeroes method from your main cpp file you need to follow these steps 1 Include ... View full answer

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 Algorithms Questions!