|
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
|
#include <iostream>
using namespace std;
int main()
{
int d,m,a;
while(1)
{
cin >> d;
if(cin.eof())
{
return 0;
}
cin >> m;
cin >> a;
if(d <= 0 || d >= 32 || (m == 2 && d >= 30))
{
goto incorrect;
}
if(m <= 0 || m >= 13)
{
goto incorrect;
}
if(d == 31 && (m == 4 || m == 6 || m == 9 || m == 11))
{
goto incorrect;
}
if(a - (a/100)*100)
{
if((a % 4 != 0) && m == 2 && d == 29)
{
goto incorrect;
}
}
else
{
if(((a/100) % 4 != 0) && m == 2 && d == 29)
{
goto incorrect;
}
}
goto correct;
incorrect:
cout << "Incorrect Date" << endl;
continue;
correct:
cout << "Correct Date" << endl;
}
}
|