i've got this code:
when i enter a string with spaces cin only records in s til the first space.Code:cout <<"insert a string: "; std::string s; cin>>s;
example:
insert a string: Hello world!
only hello is stored in s.
I've heard that the getline functions solves this. I read Eckel's thinking in c++ vol 2 but i couldn't understand how to use it. Would you mind telling me?
thanls!!


Reply With Quote

Bookmarks