-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleap.cpp
More file actions
60 lines (51 loc) · 966 Bytes
/
leap.cpp
File metadata and controls
60 lines (51 loc) · 966 Bytes
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
#include <iostream>
using namespace std;
int monthDay(int year, int month){
int days31[]={1, 3, 5, 7, 8, 10, 12};
int days30=[]={4, 6, 9, 11};
string d31="31":
string d30="30";
if (month==2){
leapYear
for (int i=0; i<sizeof(days31)/sizeof(days31[0]); i++){
if (month==days31[i]){
return d31;
}
}
for (int i=0; i<sizeof(days31)/sizeof(days31[0]); i++){
if (month==days31[i]){
return d31;
}
}
for (int j=0; j<sizeof(days30)/sizeof(days30[0]); i++){
if (month==days30[i]){
return d30;
}
}
}
switch(month){
case 1:
cout<<days31;
break;
case 2:
leap
cout<<days31;
break;
bool leapYear(int year, int month){
if ((year%4!=0)||(year%400!=0)){
return false;
}
else if (year%100!=0){
return true;
}
else{
return true;
}
}
int main(){
leapYear(2000);
cout<<endl;
leapYear(2400);
cout<<endl;
leapYear(2800);
}