-
Notifications
You must be signed in to change notification settings - Fork 0
/
valid_date.cpp
executable file
·56 lines (50 loc) · 1 KB
/
valid_date.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
#include<iostream>
using namespace std;
int main()
{
int d,m,y,l=0;
cout<<"enter th edate";
cin>>d>>m>>y;
if(y%4==0)
l=1;
if(y<=2015 && y>=1985)
{
if((m%2!=0)||(m==8))
{
if(d>=1 && d<=31)
cout<<"date is a valid date";
else
cout<<"date is invalid";
}
else
{
if(m==2)
{
if(l==1)
{
if(d>=1 && d<=29)
cout<<"date is a valid date";
else
cout<<"date is invalid";
}
else
{
if(d>=1 && d<=28)
cout<<"date is a valid date";
else
cout<<"date is invalid";
}
}
else
{
if(d>=1 && d<=30)
cout<<"date is a valid date";
else
cout<<"date is invalid";
}
}
}
else
cout<<"date is not valid";
return 0;
}