What data type should I use to save a user's sentence in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What data type should I use to save a user's sentence in C++?

7th Jan 2018, 12:27 PM
Elena
Elena - avatar
4 Answers
+ 11
Sentence here means words separated by space? if that's the case, then you go for string, and use getline to get a sentence. Otherwise more information about this "sentence" would be needed before anyone can answer your question. Example: string sentence; getline(cin, sentence); cout << sentence; Hth, cmiiw
7th Jan 2018, 12:35 PM
Ipang
+ 11
This data type is covered here: https://www.sololearn.com/learn/CPlusPlus/1623/
7th Jan 2018, 12:36 PM
jay
jay - avatar
+ 4
@Elena, you're welcome, glad to help, oh and do follow @Jay's link to the lesson, it's great : )
7th Jan 2018, 12:44 PM
Ipang
+ 3
#Ipang ,thanks,all is going right.
7th Jan 2018, 12:42 PM
Elena
Elena - avatar