how do I concatenate two strings entered by the user having spaces in both the strings and display the same?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how do I concatenate two strings entered by the user having spaces in both the strings and display the same??

please write code for it??

17th Jul 2016, 1:25 PM
kamal joshi
kamal joshi - avatar
4 Answers
0
string A; string B; cin >> A >> B; cout << A+B << endl; Do you mean with the space or without?
17th Jul 2016, 2:02 PM
_Geometry dash_ _Roh_ (AKA NovaRate0315)
_Geometry dash_ _Roh_ (AKA NovaRate0315) - avatar
0
with spaces
17th Jul 2016, 2:04 PM
kamal joshi
kamal joshi - avatar
0
use getline() function it includes spaces and counts them as well
17th Jul 2016, 6:19 PM
Suhail Pappu
Suhail Pappu - avatar
0
but it adds an extra space while concatenating I tried it.
18th Jul 2016, 10:15 AM
kamal joshi
kamal joshi - avatar