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

Pages: 1-

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:25

No.

Name: Anonymous 2011-04-14 9:27

C++ vector help
The purpose of this programs is to have a user input games he wants to save to a list

Name: Anonymous 2011-04-14 9:29

٩๏̯͡๏)۶  -  holy shit your code is fucking balls

Name: Anonymous 2011-04-14 9:30

I need to be able to remove items from a vector when the user inputs the name of an element entered earlier.

Name: Anonymous 2011-04-14 9:31

>>4

Its my third program. I know that already. What I don't know is:

>>5

Name: Anonymous 2011-04-14 9:32

>>6
Guess what, cin << x stops reading as soon as a whitespace character is encountered. Oh no, I helped him!

Name: Anonymous 2011-04-14 9:34

>>7
How can I remedy this?

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.

Name: Anonymous 2011-04-14 9:35

>>8
Keep reading.

Name: Anonymous 2011-04-14 9:36

>>7
<<
lol bitshift

Name: Anonymous 2011-04-14 9:36

>>6
It doesn't even compile you fuckstick.

Name: Anonymous 2011-04-14 9:38

vector
list

Name: Anonymous 2011-04-14 9:39

>>9

Thanks man.

Name: >>12 2011-04-14 9:40

Oh, it doesn't compile because you didn't even include the string header. Yet you're using strings.

Name: Anonymous 2011-04-14 14:36

GUISE HALP Y IT NO COMPIL??/?

#include String.h

Using Namespace String.

main)(
{
  hi = "hi";
  return 0;;;;;;;;;;;;
}

Name: Anonymous 2011-04-14 15:02

>>16
Not enough semicolons.

Name: Anonymous 2011-04-14 15:06

>>16
lol u n00bz0r u shuodl maek hi const

#inclued Strng,h

using anem space string;
main((
{
   const hi = "hi";
   return 0;;
}

Name: Anonymous 2011-04-14 16:47

>>16,18

You're not funny.

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