How to take a string with spaces without disturbing the input stream? I mean cin does not skip next inputs. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to take a string with spaces without disturbing the input stream? I mean cin does not skip next inputs.

I tried using different methods like cin.getline function but i observed that sometimes it skips next inputs, specially when next input is also a string or a character. So i want to know how to deal with this problem?

17th Feb 2017, 10:40 AM
Saad Sohail
Saad Sohail - avatar
1 Answer
0
getline() is a function, abd it doesnt need cin to work. you can use it by itself on a separate line
18th Feb 2017, 12:08 PM
Orfeo Terkuci
Orfeo Terkuci - avatar