Hi all,
as introduced before, I am a beginner about C++. I'm studing this tutorial
http://www.cplusplus.com/doc/tutorial/structures/
and I don't understand really what is it
stringstream
I searched on Documentation, I found this,
http://www.cplusplus.com/reference/sstream/stringstream/?kw=stringstream , but I don't actually understand how to read documentation. Could someone help me to understand to read documentation? For example what are flow chart at the beginning of the page?
In the tutorial, at the paragraph 'Pointers to structures', is stingstream is used for a cast? What does it mean?
In the previous paragraph I read this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
// example about structures
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
struct movies_t {
string title;
int year;
} mine, yours;
void printmovie (movies_t movie);
int main ()
{
string mystr;
mine.title = "2001 A Space Odyssey";
mine.year = 1968;
cout << "Enter title: ";
getline (cin,yours.title);
cout << "Enter year: ";
getline (cin,mystr);
stringstream(mystr) >> yours.year;
cout << "My favorite movie is:\n ";
printmovie (mine);
cout << "And yours is:\n ";
printmovie (yours);
return 0;
}
void printmovie (movies_t movie)
{
cout << movie.title;
cout << " (" << movie.year << ")\n";
}
|
Now stringstream is a function. Where is its definition? How could I find it in Documentation?
Sorry for my stupid questions, but I find a lot of difficulties to read Documentation probably formatted for experts. If someone provide to explain how to read Documentation, for general pourpuse, he will give me and others beginners a big help!
Thanks a lot!!