It is not supported in Oracle :(

AoA
I am new to this community just joined it yesterday. Want to know the way how to help others and get helped. I am a good learner and just love C++ language. Wanna grow in this field. :D

I have came up with this code.
But some errors are there. Do let me know about this :)

[CODE]#include

include

int leapyear(int);
int Month_31(int);

/* d1.print_nz(); // outputs 26/03/1999
d1.print_text(); // outputs Friday, 26th March 1999

cout << d1;     // outputs Friday, 26th March 1999

Dates can be manipulated by adding a number of days
(from 0 to 999,999) - either by calling a function:

d1.add(1234);

or by using the overloaded + operator:

d2 = d1 + 1234;*/

class Date
{
int Day,Month,Year;
public:

Date()
{

}
int check_days_of();
void print_nz() // outputs 26/03/1999
{
cout<<Day<<"/"<<Month<<"/"<<Year;
} //end of print_nz
void print_text(); // outputs Friday, 26th March 1999

void add(long N);
friend istream& operator>>(istream& cin, Date& D);
friend void operator<<(ostream& cout, const Date& dt);
Date(int Day,int Month,int Year)
{
this->Day=Day;
this->Month=Month;
this->Year=Year;
}
void setDate()
{
int DayMonth,Year;
cout<<"\n Enter Day";cin>>Day;
this->Day=Day;
cout<<"\nEnter Month";cin>>Month;
this->Month=Month ;
cout<<"\n Enter Year";cin>>Year;
this->Year=Year;
}
void showDate()
{
cout<<"\n Day="<<Day<"\t";
cout<<"\n Month="<<Month<"\t";
cout<<"\n Year="<<Year<"\t";
}

} ;//end of Date

    //check_days_of(month)

int Date:: check_days_of()
{
int arr[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if(leapyear(Year))
return 29;
else
return arr[Month-1];
}
//Add()
void Date:: add(long N)
{
//int d=;
while(Day+N>this->check_days_of())
{
if(Month==12)
{
Year++;
Month=1;
}
else Month++;
if(N>this->check_days_of())
N=N-this->check_days_of();

}
Day+=N;
}

//end of add()

//Overloading -

void operator<<(ostream& cout, const Date& D)
{
cout << D.Day << '/' << D.Month << '/' << D.Year;

}
//end of operator << overloading
istream& operator >>(istream& cin, Date& D)
{
int Da,M,Y;
cout<<"\n\nEnter DAY";cin>>Da;
cout<<"\n\nEnter month";cin>>M;
cout<<"\n\nEnter year";cin>>Y;
D.Day=Da;D.Month=M;D.Year=Y;
return cin;

}
end of operator >> overloading::
int Month_31(int M)
{
switch(M)
{
case 1:
case 3:
case 5:
case 7: ...

The class should be capable of storing, manipulating and printing dates. Dates can be initialized by assigning 3 numbers - the day, the month and the year (initially restricted to any date after 1st January 1900 and before the year 3000)

e.g. Date d1(26,3,1999);

Dates will be printed by either of two member functions:

d1.print_nz();  // outputs 26/03/1999
d1.print_text();    // outputs Friday, 26th March 1999

or by the overloaded << operator:

cout << d1;     // outputs Friday, 26th March 1999

Dates can be manipulated by adding a number of days (from 0 to 999,999) - either by calling a function:

d1.add(1234);

or by using the overloaded + operator:

d2 = d1 + 1234;

#include <iostream.h>                   |   #include <iostream.h>
#include "a3.h"                     |   #include "a3.h"
using namespace B;              |   using namespace B;
                        |
int main() {                    |   int main() {
   Date d1(26,3,1999),d2;           |      Date d1(1,1,2000);
                        |
   d1.print_nz();               |      d1.print_nz();
   cout << endl;                |      cout << endl;
   d2 = d1 + 6;                     |      d1.add(999999);
   cout << d2 << endl;                  |           d1.print_text();
}                       |      cout << endl;
                        |   }

produces as output:

26/03/1999                  |   01/01/2000
Thursday, 1st April 1999            |   Saturday, 27th November 4737

There are 365 days in a year, except for leap years, when there are 366. Leap years are all divisible by 4 and not 100, except that those divisible by 400 are leap years. So 2100 and 2200 are not leap years, 2000 2004 2008 2400 are leap years.

Zeller’s Congruence is a method for finding the day of the ...