#include<iostream.h>
class nd
{
private:
int d,m,y;
public:
nd(int year,int month,int day)
{
y=year,m=month,d=day;
}
friend void display(nd);
};
void display(nd d1)
{
switch(d1.m)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
if((d1.m==12)&&(d1.d==31))
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y+1<<"年"<<1<<"月"<<1<<"日"<<endl;
cout<<endl;
}
else if(d1.d==31)
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y<<"年"<<d1.m+1<<"月"<<1<<"日"<<endl;
cout<<endl;
}
else
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y<<"年"<<d1.m<<"月"<<d1.d+1<<"日"<<endl;
cout<<endl;
}
break;
case 2:
if((d1.m==12)&&(d1.d==28))
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y+1<<"年"<<1<<"月"<<1<<"日"<<endl;
cout<<endl;
}
else if(d1.d==28)
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y<<"年"<<d1.m+1<<"月"<<1<<"日"<<endl;
cout<<endl;
}
else
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y<<"年"<<d1.m<<"月"<<d1.d+1<<"日"<<endl;
cout<<endl;
}
break;
case4:
case6:
case9:
case11:
if((d1.m==12)&&(d1.d==30))
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y+1<<"年"<<1<<"月"<<1<<"日"<<endl;
cout<<endl;
}
else if(d1.d==30)
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y<<"年"<<d1.m+1<<"月"<<1<<"日"<<endl;
cout<<endl;
}
else
{
cout<<"当前日期为"<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
cout<<endl;
cout<<"明天日期为:"<<d1.y<<"年"<<d1.m<<"月"<<d1.d+1<<"日"<<endl;
cout<<endl;
}
break;
}
}
void main()
{
nd d1(2001,1,1);
display(d1);
nd d2(2001,1,30);
display(d2);
nd d3(2001,12,30);
display(d3);
}