# Hi kirupa,

**URL:** <https://forum.kirupa.com/t/hi-kirupa/230834>\
**Category:** Uncategorized\
**Created:** [June 29, 2007, 9:19am UTC](https://forum.kirupa.com/t/hi-kirupa/230834 "2007-06-29T09:19:24Z")\
**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:** [June 29, 2007, 9:19am UTC](https://forum.kirupa.com/t/hi-kirupa/230834/1 "2007-06-29T09:19:24Z")

</div>

hi kirupa,hw r u?  
i hope u will be fine.  
thankx 4 everything,

hi viewers, i hv one problem about c++ program.  
i hv done the program using c++,the program run bt not like our expected.  
so can u show me where’s the mistake…???  
i need everybody help me…  
pls show me the mistake here…

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&lt;&lt;"the number of days for the month" &lt;&lt;monthName() &lt;&lt;endl;
      cout &lt;&lt;" is "&lt;&lt;days &lt;&lt;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 the program,  
i hope u can help me as soon as possiable

thankx,
