# \[hi kirupa,\] Cannot get some date-related code to work \[renamed\]

**URL:** <https://forum.kirupa.com/t/hi-kirupa-cannot-get-some-date-related-code-to-work-renamed/231035>\
**Category:** programming\
**Created:** [July 1, 2007, 1:26pm UTC](https://forum.kirupa.com/t/hi-kirupa-cannot-get-some-date-related-code-to-work-renamed/231035 "2007-07-01T13:26:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![indu\_laksmi](https://avatars.discourse-cdn.com/v4/letter/i/e56c9b/32.png) [@indu\_laksmi](https://forum.kirupa.com/u/indu_laksmi)\
**Post date:** [July 1, 2007, 1:26pm UTC](https://forum.kirupa.com/t/hi-kirupa-cannot-get-some-date-related-code-to-work-renamed/231035/1 "2007-07-01T13:26:36Z")

</div>

hi kirupa,thanksx 4 everything.  
now i want to post one of mu work (unfinished work).  
i mean i hv make it but it can work properly,  
i dont knw why?  
i hope all the viewers can help me to show why my work didnt work…

here it is,

using namespace std;  
#include\<iostream\>  
class DayCount  
{  
int month;  
int year;  
int days;

public:  
DayCount()  
{  
month=0;  
year=0;  
}

int leap()  
{  
if (year%4 ==0 || year%400!=0)  
return 1;  
return 0;  
}  
void setDate(int month, int year)  
{  
this, year=year;  
this,month=month;  
}  
void setDate(int month)  
{  
month=month;  
}  
char \*monthName()  
{  
switch (month)  
{  
case 1: return “January”;  
case 2: return “February”;  
case 3: return “March”;  
case 4: return “April”;  
case 5: return “May”;  
case 6: return “June”;  
case 7: return “January”;  
case 8: return “February”;  
case 9: return “March”;  
case 10: return “April”;  
case 11: return “May”;  
case 12: return “June”;  
}

}

void setDays()  
{  
switch(days)  
{  
case 1:  
case 3:  
case 5:  
case 7:  
case 8:  
case 10:  
case 12:  
days=31;  
case 2:  
days=28;  
if (leap())  
days=29;  
case 4:  
case 6:  
case 9:  
case 11:  
days=30;  
}  
}

void display()  
{  
cout\<\<“the number of days for the month” \<\<monthName() \<\<endl;  
cout \<\<" is "\<\<days \<\<endl;  
setDays();  
}

};  
int main()  
{  
DayCount daycount;  
daycount.setDate(3,2001);  
daycount.display();  
daycount.setDate(2,2002);  
daycount.display();  
daycount.setDate(6,2001);  
daycount.display();  
daycount.setDate(2);  
daycount.display();  
system(“pause”);  
return 0;  
}

above is my work.  
pls show me the mistake that make the work didnt work.

thankxfor everything…
