int main() { #ifdef __MSVC_DEBUG__ InitLeakTest(); #endif CDate cdate; cout << "Enter a date: " << "\n"; cin >> cdate; cout << "\n"; cout << "Testing overloaded << operator..." << "\n"; cout << "You Entered: " << cdate << "\n"; cout << "\n"; cout << "Testing c_str() function..." << "\n"; char *buf = cdate.c_str(); cout << "You Entered: " << buf << "\n"; delete buf; // Free the memory allocated for the string cout << "\n"; char sbuf[255]; cout << "Enter a date string MM/DD/YYYY: "; cin >> sbuf; if(!cin) { cout << "Bad input string" << "\n"; } else { if(!cdate.SetDate(sbuf)) { cout << "Bad input value" << "\n"; } else { buf = cdate.c_str(); cout << "You Entered: " << buf << "\n"; delete buf; // Free the memory allocated for the string } } return 0; }