Storing words with blank space


Hi, I have a quick question! I tried looking for it but couldn't find it.

How do I store words containing a space into a variable?

For example

1
2
3
string order;
cout << " Hi! What would you like order? << endl;
cin >> order; 


I'd like to be able to store "A Hamburger" (including the space) into the variable order. How would I do it?
Thank you guys very much! This site is really helpful!
use getline(cin, order); instead of cin >> order;
Standard string extraction stops on whitespace characters, so you'll have to the getline function. getline(std::cin, order);.
Last edited on
Thank you guys! I apologize for asking a question that is answered on my book. I just didn't look well enough and over looked the little section on it!
Thanks again!
Topic archived. No new replies allowed.