0
When do you use the getline?
i have been watching videos on C++ and some ask for user input with cin >> variable and some use getline (cin, variable) Is there a difference and when woukd you uae one rather than the other. Thank you.
2 Antworten
+ 4
getline => getting line: exp char* "my name is chokri"
=> cin getting first string: just "my" word.
Thanks.
+ 2
getline gets the entire line, while cin only gets the letters/numbers up until it encounters a space or the line ends