Why do we use getline, can't we just cin for that? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why do we use getline, can't we just cin for that?

What is main difference in them and what are advantages of using getline function.

6th Nov 2016, 5:38 PM
Muhammad Hamza
Muhammad Hamza - avatar
1 Answer
+ 3
Cin gets only first word of input while getline function gets the whole line Including spaces and other characters.
19th Jan 2017, 4:59 PM
Muhammad Hamza
Muhammad Hamza - avatar