how to output phrases? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to output phrases?

as a (let's say, a "booster") to a larger project, i'm trying to output an inputted phrase(as in, the entire string) stored in a string, but only the first letter is displayed. any solutions? code i'm referencing: https://code.sololearn.com/c412kH3uod63

19th Oct 2017, 2:33 PM
X-1
X-1 - avatar
2 Answers
+ 1
Replace cin >> s; By getline(cin, s); cin read up to a separator which is by default any white space, so what you read is not a line but just the first word of the line.
19th Oct 2017, 3:08 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
19th Oct 2017, 3:08 PM
Dennis
Dennis - avatar