In Java I could use an arraylist and this wouldn't be a problem but I'm not sure how to do this correctly in C++. I'm trying to simulate a draft and so I need to add and remove people from a list.
Code:vector<Player> PlayerIO::draft() { string ans = "y" ; int i = 0; vector<Player> myPlayers; vector<Player>::iterator it = allPlayers.begin(); cout << "Enter 'y' for yes, 'n' for no, 't' for taken, 'b' for beginning of list, 'q' for quit" << endl; while(allPlayers.empty() == false | ans.compare("q")!=0 ) { cout << "Pick " << allPlayers[i].getName() << " ?"; cin >> ans; if(ans.compare("y")==0) { myPlayers.push_back(allPlayers[i]); allPlayers.erase(it); } else if(ans.compare("t")==0) { allPlayers.erase(it); } else if(ans.compare("n")==0) { i++; it++; } else if(ans.compare("b")==0) { i=0; it = allPlayers.begin(); } } return myPlayers; }