strings that accept spaces

I'm trying to create a program where you enter questions and somebody else tries to answer them. My problem is that when you enter a space, the program puts the first word in as the first string then puts the next word in as the next string. I tried cin.ignore() but all it did was make me enter the string twice and do the same exact thing again. Then I tried cin.ignore(32), which confused me even more. I saw a post about something like this before but when I went looking for it today it was gone. How do you get the program to ignore the spaces in the string while still having them in the string?
Use getline instead of the >> operator.

See this page for examples:

http://cplusplus.com/reference/string/getline/


EDIT: wait, am I understanding your question properly?
Last edited on
It worked. Thank you. You were exactly right.
Topic archived. No new replies allowed.