i was reading the tutorial in this site and found this example but i can't understand what is (Getline)
can anybody tell me what is this i know that is used in <string> but why,and How
and what is <sstream>
get.ine() is a function that allows you to read input up to a specified delimite(normally a newline character) whiles cin reads up to any whitespace character.
Also,<sstream> is a header that allows you to fully use string streams.
What this line is saying is it will read in all characters until it hits a \n (Newline character) which happens when you press enter. It will then put what it has read into the member yours.title
Think about this for a second. Lets look at this example of using cin instead of getline().
1 2 3
cin >> myword;
cout << myword;
What would happen if the user entered the sentance "Hello how are you?"? Well the output would look like this
This is because cin stop at the first wightspace it see's (Which is the space right after "Hello").
Now if we used getline() instead of cin it would read up until it hits a \n character by default (It is possible to change where getline() stops by using it's second argument which is optional). So it would print out the whole sentance the user entered instead of just the first word.
As for stringstreams they are a bit of a advanced topic that you might wanna learn about later after you get more experience with how streams in general work. You can read more about them on this website just type in stringstreams into the search.