1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include <iostream>
#include "age.h"
using namespace std;
int main(){
Age AD1(1994, 12, 25, 3, 4, 5);
Age AD2(1994, 12, 25, 3, 4);
Age AD3(1994, 12, 25, 3);
Age AD4(1994, 12, 25);
//Age AD(2086, 1, 2) // error
// Age AD(1945, 1, 2) // error
// Age AD(2013, 0, 2) // error
// Age AD(2013, 13, 2) // error
// Age AD(2013, 1, 0) // error
// Age AD(2013, 1, 32) // error
// Age AD(2013, 13, 2, -1) // error
// Age AD(2013, 13, 2, 24) // error
// Age AD(2013, 13, 2, 3, -1) // error
// Age AD(2013, 13, 2, 3, 60) // error
// Age AD(2013, 13, 2, 3, 4, -1) // error
// Age AD(2013, 13, 2, 3, 4, 60 ) // error
AD1.display();
cout << endl;
AD2.display();
cout << endl;
AD3.display();
cout << endl;
AD4.display();
cout << endl;
// suppose today is 15/04/2015
Age AD5(2015, 4, 15);
Age AD6(2015, 4, 1);
Age AD7(2015, 3, 15);
Age AD8(2014, 12, 25);
Age AD9(2014, 1, 25);
AD5.display();
cout << endl;
AD6.display();
cout << endl;
AD7.display();
cout << endl;
AD8.display();
cout << endl;
AD9.display();
cout << endl;
return 0;
}
| |