/* * @topic T00290 <span style="background-color: yellow;">New: </span>Serial Date class (Spring 2014) * @brief main function -- you need to replace this by <a href="http://www.c-jump.com/bcc/c155c/c155samples/wk09_SDate/SDate_main.cpp">SDate_main.cpp</a> */ //#define NDEBUG // uncomment to disable asserts #include <cassert> #include <iostream> #include "SDate.h" void pause() { //---------------------------------------------- // prevent window from closing before exiting: //---------------------------------------------- char ch; // ch is a variable that holds a character // curious \n is a "line feed" control character, // it moves the cursor to the next line: std::cout << "\nEnter X to Exit: "; std::cin.ignore( 1, '\n' ); // extract and discard characters std::cin.clear(); // this clears cin state std::cin.get( ch ); // this reads a character from the keyboard, // and pauses the program from before exiting } int main() { SDate dt; dt.set( 4, 10, 2014 ); std::cout << dt.serial() << '\n'; dt.serial( 19990131 ); std::cout << dt.serial() << '\n'; std::cout << dt.month() << "/" << dt.day() << "/" << dt.year() << '\n'; pause(); return 0; }