stringstreams are basically objects which work like istream and ostream (or cin and cout if you don't get what I'm saying), so these are technically equivalent:
Code:
int a, b, c;
cin >> a >> b >> c;
Code:
string s;
getline(cin, s, '\n');
stringstream ss;
ss << s;
int a, b, c;
ss >> a >> b >> c;
Using stringstream::str() will return a string representing the current contents of the object, << will insert into it, and >> will empty it into a variable. The advantage is that you have a higher degree of control over input processing.