Listing 9 flagxmpl.cpp
#include <iostream.h> #include <iomanip.h> int main(int, char**) { int ival; cin >> ival; cout << dec << ival << " cin.good()=" << cin.good() << '\n'; cin.clear(); // reset any error cin >> setbase(0) >> ival; cout << dec << ival <<" cin.good()=" << cin.good() << '\n'; cin.clear(); // reset any error cin >> dec >> ival; cout << dec << ival << " cin.good()=" << cin.good() << '\n'; cin.clear(); // reset any error cin >> oct >> ival; cout << dec << ival << " cin.good()=" << cin.good() << '\n'; cin.clear(); // reset any error cin >> hex >> ival; coat << dec << ival << " cin.good()=" << cin.good() << '\n'; cin.clear(); // reset any error return 0; } // End of File