I have started reading the "jump to C++" book that I purchased from the parent website.
My question is about strings,
In chapter 3
I started with using "cin" to write to a string that i created. That made sense. Then he had me concatenate two strings together , that made sense. Where i got confused was were the author states(quote from the book)
"When you read in strings, sometimes you want to read a whole line at a time. There is a special function getline
, which can be used to read in the whole line. It will even automatically discard the newline
character at the end.
I dont understand what he means by read in a whole line... what is the differnece between a line and a string? how does
getline( cin, user_first_name, '\n' );
cin >> user_firstname;
I feel some very basic principles are being glazed over.
Another issue involing the getline function, the author mentions you can set the "getline" function to only get a string up to a particualr character... and then say you would need to call another input function to get the rest from the input buffer but then mention how to do this...
I thank you all for your time and expertise and i do appogize if these are stupid questions... I am just trying to make sense of programming(somthing I have done very very little)