5
[C++] Simple question regarding getline
Post Flair (click to view more posts with a particular flair)
Post Body
Can I use cin.getline in a program to read a string line for something like a sentence, so that only the first word is recorded?
I was thinking something like cin.getline ( sentenceVar, 20, ' ') would work. Would this work? Thank you.
Thanks you guys, it was great help!
Author
Account Strength
100%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
34,885
Link Karma
8,766
Comment Karma
25,911
Profile updated: 4 days ago
Posts updated: 7 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 11 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnprogra...