sstream...

//why we can't use insertion or extraction from string to string using string stream.
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string first, second;
getline(cin,first);
// "first" will only insert the value till space, like if we input "he is nineteen" in first
stringstream(first)>>second;
cout<<second;
//second will just output the value "he"

return 0;
}
thank You
That's how the extraction operators work. If you want all of it, you can use .str().
Topic archived. No new replies allowed.