C++ Program : to find Leap year




#include<iostream.h>
#include<conio.h>

class year
{
   public:
   int year;
   int leapyear()
   {
      if(year%4==0)
         return 1;
      else
         return 0;
   }
};

int main()
{
   clrscr();
   year ob;
   cout<<"Enter the year :";
   cin>>ob.year;
   if(ob.leapyear())
      cout<<"\tThe year is a leap year";
   else
      cout<<"\tThe year is not a leap year";
   getch();
   return 0;
}

Class diagram 

(click image to view large)

 

 

Related Posts:

0 comments:

Post a Comment