string x; getline(cin, x); Also:
char meh[100]; gets(meh); null terminated strings are a bad habit if you plan making apps with C+ + later . I think though that there is a safer version of gets that takes a limit for the number of characters... On Sep 3, 10:47 pm, 有D <[email protected]> wrote: > hey, I am not very famliar with C++. > Can any one tell me how to acquire one line(including space) from the > console conveniently? > I used the scanf("%s", &str); > but it will be cut off if there is any space in your input. > for example, if you input "hello world" > than the world is just omited. str = hello; > > -- > 有D --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-code?hl=en -~----------~----~----~----~------~----~------~--~---
