-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestDate.cpp~
61 lines (56 loc) · 1.16 KB
/
TestDate.cpp~
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
56
57
58
59
60
61
#include "Date.h"
void TestDate()
{
try{
DateFormat dff("aa-bb-yy");
Date::setFormat(dff);
cout<<"OK"<<endl;
Date gh;
cout<<gh<<endl;
DateFormat df("dd-mmm-yy");
Date::setFormat(df);
cout<<"Lets keep going..."<<endl;
Date a;
a++;
++a;
cout<<"a = "<<a<<endl;
cout<<"Here"<<endl;
Date b( D28,Feb,2012 );
cout<<"b= "<<b<<endl;
//Date b("28-Feb-16");
b = b-20;
cout<<"b-20 = "<<b<<endl;
int n=a-b;
cout<<a<<" - "<<b<<" = "<<n<<endl;
Date c(D12,Feb,1981);
cout<<"c = "<<c<<endl;
Date cs(D01,Jan,2016);
cout<<"cs = "<<cs<<endl;
int nn = WeekNumber (cs);
cout<<"Weeknumber: "<<nn<<endl;
// for(int i=0; i<53; i++,c++){
// WeekNumber wn=WeekNumber(c);
// cout<<c<<" "<<wn<<endl;
// }
DateFormat ddff(0,0,0);
Date::setFormat(ddff);
Date ddae(D26,Feb,2002);
cout<< ddae<<endl;;
//cout<<n;
}
catch(invalid_argument& e){
cout<<"You typed an incorrect argument..."<<e.what()<<endl;
}
catch(out_of_range& e){
cout<<"You typed an out-of-range argument..."<<e.what()<<endl;
}
catch(domain_error& e){
cout<<"There seems to be a domain error..."<<e.what()<<endl;
}
}
int main()
{
TestDate();
/**/
return 0;
}