Hi.
I wrote a program that lets me put in 2 games, then the program display the 2 games and ask me what game I would like to delete.
The problem occurs when im trying to write a game with two names (king kong for example)
the program thinks that the whitespace between the names means that im done with my first game.
so the program displays that I have 2 games and they are named king and kong.
How do I ignore that whitespace?
Code:int main() { string list; string list1; vector<string> gList; vector<string>::iterator game; vector<string>::const_iterator myGame; cout << "Please insert a game you would like to add: "; cin >> list; gList.push_back(list); cout << "Please insert another game: "; cin >> list1; gList.push_back(list1); cout << "you got " << gList.size() << " games."; for(game = gList.begin(); game != gList.end(); ++game) cout << "\nAnd they are: " << " " << *game; getch(); system("cls"); string choice; cout << "Would you like to remove " << list << " or " << list1 << "?"; cin >> choice; if(choice == list) { gList.erase(gList.begin()); } else if(choice == list1) { gList.erase((gList.begin()+1)); } cout << "You now got " << gList.size() << " game left."; for(myGame = gList.begin(); myGame != gList.end(); ++myGame) cout << "\nAnd it is " << *myGame; getch(); return 0; }