Added: year → eg (2004.2005, etc.)
Output: leap Has the program:
1. Class
2. Constructors
3. Operator overloading I / O
# Include <cstdlib>
# Include <iostream>
using namespace std;
class leap {
friend istream & operator>> (istream &, intercalary &);
friend ostream & operator <<(ostream &, intercalary &);
public:
intercalary ();
int process () {return result = n% 4;};
private:
int n;
int result;
};
leap:: leap () {court <<"Finding a leap year \ n";}
istream & operator>> (istream & ins, intercalary & input) {
court <<"enter the year:";
in>> masukan.n;
return ins;
}
ostream & operator <<(ostream & out, leap & out)
if (keluar.hasil == 0) {
out <<"leap year"; }
else {
out <<"not a leap";
}
return out;
}
int main (int argc, char * argv [])
{
intercalary x;
cin>> x; x.proses ();
court <<x; court <<endl;
system ("PAUSE");
return EXIT_SUCCESS; }
JELIOT VERSION:
jeliot.io import .*;
class leap
{
public intercalary () {number = 0;}
public void process ()
{
System.out.print ("Enter Year:");
year = Input.readInt ();
if (year% 4 == 0)
{
System.out.println ("\ n");
System.out.println ("Year");
System.out.print (years);
System.out.println ("is a leap year");
System.out.println ("\ n");
}
else if ((year% 100! = 0) & & (year% 400! = 0) & & (year% 4 == 0))
{
System.out.println ("\ n");
System.out.println ("Year" + year + "leap year");
System.out.println ("\ n");
}
else if ((year% 100! = 0) & & (year% 400! = 0) & & (year% 4! = 0))
{
System.out.println ("\ n");
System.out.println ("Year" + year + "is not a leap year");
System.out.println ("\ n");
}
else if ((year% 100 == 0) & & (year% 400! = 0))
{
System.out.println ("\ n");
System.out.println ("Year" + year + "is not a leap year");
System.out.println ("\ n");
}
else
{
System.out.println ("wrong input");
}
}
private int year;
private int number;
public static void main ()
{
intercalary leap X = new ();
X.proses ();
}}

Leave reply