#include #include #include using namespace std; // do not use this trick for the first assignment, // use strtod as seen in previous class instead. int main() { while (true) { string line; cout << ">>> "; getline(cin, line); if (cin.eof()) break; istringstream ssin(line); while (true) { double d; string s; ssin >> d; if (ssin.eof()) { cout << "end of line\n"; break; } if (ssin.fail()) { ssin.clear(); ssin >> s; cout << "the string \"" << s << "\"\n"; } else cout << "the number " << d << "\n"; } } cout << "all done\n"; }