Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ vector help

Name: Anonymous 2011-04-14 9:23

The purpose of this programs is to have a user input games he wants to save to a list and then remove and search the list.

The problems I was having before I changed the section about removing games are:
When I enter a name with spaces (Team Fortress 2) to add to the list, my program displays "What do you want to do? Commands are etc." over and over.
I don't know how to have the user input the name of a game and then have the game removed from the vector.

http://pastebay.com/120455

Could anyone help me?

Name: Anonymous 2011-04-14 9:35

>>1
Instead of reading space-separated tokens (interpreting them as commands) use std::string::getline(), then split the string into command and name parts manually. Removing extra whitespace characters from the beginning and end would be a good idea. Or you can even assign the string to a std::istringstream object, and extract the data from that, then concatenate all words past the command to form a name. This way you can write "  1     Team         Fortress  " and all superfluous spaces would be removed.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List