We help IT Professionals succeed at work.

How to input a string using "cin"?

t_bird
t_bird asked
on
Hi, there,
I want to use "cin" to input a string such like "aaa bb cc " through keyboard, there are spaces in the string, how can I do it? Thanks.
Comment
Watch Question

Commented:
std::string str;
std::getline(std::cin, str);

Commented:
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "vickirk" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: http://www.experts-exchange.com/commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Force-accepted by
Netminder
CS Moderator

Explore More ContentExplore courses, solutions, and other research materials related to this topic.