It's because the input you are probably using, by definition, stops inputting at a SPACE. Your error is not in the code posted.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
if you want to get a whole of text uasing cin you need to use getline()
NathanOliver
Veteran Poster
1,084 posts since Apr 2009
Reputation Points: 215
Solved Threads: 189