diff --git a/Untitled3.cpp b/Untitled3.cpp new file mode 100644 index 0000000..3b2ae3f --- /dev/null +++ b/Untitled3.cpp @@ -0,0 +1,345 @@ +#include +#include +#include +int monthdays[12] = {31,28,31,30,31,30,31,31,30,31,30,31} ; +char yearr(int year) +{ +if (year%4==0&&year%100||year%400==0) +return 1; +else +return 0; +} + int midmonthday(int m1 , int m2, int y) +{ + int i ; + int ds ; + ds = 0 ; + for(i = m1 + 1 ; i < m2 ; i++) + { + ds =ds+ monthdays[i-1] ; + if(i == 2) + { + if(yearr(y)) + { + ds++ ; + } + } + } + return ds ; +} +int SameYearDays(int y1 , int m1 , int d1 , int y2 , int m2 , int d2) +{ + int Days ; + + if(m1 == m2) + { + Days =abs(d2 - d1) ; + } + else + { + Days = abs(monthdays[m1 - 1] - d1) ; + if(m1 == 2) + { + if(yearr(y1)) + { + Days++ ; + } + } + if((m1 + 1) != m2) + { + + Days += midmonthday(m1 , m2, y1); + } + Days += d2 ; + } +return Days; +} +int GetMidYearDays(int y1,int y2) +{ +int days=0; +int i=0; +for (i=y1+1;i