I am working on this code and everything is working but for some reason when i go and do case 3 for remove it removes the code but continually asks for me to remmove and no matter what i type it will not go back to default options for me ot pick. i have tried break; continue; choice = 0; combination of them but nothing seems to work.
int main()
{
vector<string> games;
vector<int>::const_iterator iter;
int choice = 0;
int game;
cout << "1. List of Games\n";
cout << "2. Add a Game you have played\n";
cout << "3. Remove a Game\n";
cout << "4. Quit\n";
while(choice != 4)
{
cout << "Choose an option: ";
cin >> choice;
switch(choice)
{
case 1:
{
for(unsigned int i = 0; i < games.size(); ++i)
cout << games[i] << endl;
choice = 0;
}
break;
case 2:
{
cout << "Enter a game to add:(nospaces)";
string game;
cin >> game;
games.push_back(game);
choice = 0;
}
break;
case 3:
{
cout << "Your game so far:\n";
for(unsigned int i = 0; i < games.size(); ++i)
cout << i << ". " << games[i] << endl;
cout << "Enter the name of a game to remove: ";
cin >> game;
iter = find(games.begin(), games.end(), games);
games.erase(games.begin() + game);
choice = 0;
}
break;
case 4:
{
cout << " You selected Quit.\n";
break;
}
}
return 0;
}