#include #include #include using namespace std; int main() { string string1("Have a nice day."); string buffer; istringstream sin(string1); // What is in the istringstream buffer? cout << "sin.str()=" << sin.str() << endl; // read from the istringstream buffer while (sin >> buffer) { cout << buffer << endl; } // Let's get a new istringstream buffer sin.str("Let's get a new istringstream buffer"); while (sin >> buffer) { cout << buffer << endl; } // Why didn't this work? // after reading from the istringstream, what is the "state" of the stream? cout << boolalpha << "sin.eof()=" << sin.eof() << endl; cout << "sin.rdstate()=" << sin.rdstate()<< endl; // clear the eofbit sin.clear(); cout << boolalpha << "sin.eof()=" << sin.eof() << endl; cout << "sin.rdstate()=" << sin.rdstate()<< endl; cout << "sin.str()="<