#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char** argv)
{
stringstream ifs{"hello"};
if (ifs.bad() == true || ifs.eof() == true || ifs.fail() == true) {
cout << "ifs state is bad" << endl;
} else {
cout << "ifs state is good" << endl;
}
ifs << "shirley";
ifs.clear(ifs.eofbit); // Set the eofbit
if (ifs.bad() == true || ifs.eof() == true || ifs.fail() == true) {
cout << "Shirley: ifs state is bad" << endl;
} else {
cout << "Shirley: ifs state is good" << endl;
}
return 0;
}