#include #include using namespace std; #include "Date.h" #include "Date.h" // an accident that should compile if you did the right thing int main( ) { const Date today( 7, 13, 1999 ); const Date millenium( "Jan", 1, 2000 ); cout << "Today is: "; today.printDate( cout ); cout << ", and there are " << millenium.daysBetween( today ) << " days until "; millenium.printDate( cout ); cout << "." << endl; cout << "Tommorrow is: "; today.dateAfter( ).printDate( cout ); cout << "." << endl; cout << "Next week is: "; today.futureDate( 7 ).printDate( cout ); cout << "." << endl; // Do some other tests... // We can have arrays of Date objects vector d; d.push_back( Date( "Feb", 2, 1963 ) ); d.push_back( Date( 6, 2, 1976 ) ); d.resize( 3 ); d[ 2 ].setDate( 12, 28, 1900 ); for( int i = 0; i < 3; i++ ) { for( int j = i + 1; j < 3; j++ ) { d[ i ].printDate( cout ); cout << " and "; d[ j ].printDate( cout ); cout << ": equal = " << d[ i ].equals( d[ j ] ) << "; lessThan = " << d[ i ].lessThan( d[ j ] ) << ";" << endl; cout << "\tdays between = " << d[ i ].daysBetween( d[ j ] ) << endl; } } return 0; }