+ 3

What is the difference between cin and getline?

24th Oct 2016, 8:12 AM
Venus
Venus - avatar
3 odpowiedzi
+ 3
cin will take input up to a space. getline() will take entire input; hence why it is often used for strings. You need to press return/enter for both...
24th Oct 2016, 2:14 PM
Cohen Creber
Cohen Creber - avatar
+ 1
In cin you have to press enter key after entering data In getline you have to just enter without pressing enter. In pc In your mobile both are same
24th Oct 2016, 9:29 AM
Jishnu
Jishnu - avatar
0
The getline is a member function of cin for input the whole line into string variable.
24th Oct 2016, 8:19 AM
Petr Hatina
Petr Hatina - avatar