#include #include #include "date.h" using namespace std; int main(int argc, char **argv) { date d; cout << "Please input a date in the format m/d/y and press RETURN: "; cin >> d; //operator>>(cin, d); if (!cin) { //if (cin.operator!()) { if (cin.eof()) { cerr << argv[0] << ": end of file\n"; } else if (cin.bad()) { cerr << argv[0] << ": can't hear from outside world\n"; } else if (cin.fail()) { cerr << argv[0] << ": input not in the format m/d/y\n"; } else { cerr << argv[0] << ": don't know why input failed\n"; } } //operator<<(operator<<(operator<<(cout, "The date was "), d), ".\n"); cout << "The date was " << d << ".\n"; return cin ? EXIT_SUCCESS : EXIT_FAILURE; }