DateType::DateType(int y0,int m0,int d0)   //设定起始日期
{
 y=y0;
 m=m0;
 d=d0;
}
void DateType::printDate(DateType &d1)     //日期输出
{
 cout<<d1.y<<"年"<<d1.m<<"月"<<d1.d<<"日"<<endl;
}
bool DateType::equal(DateType dt2)       //判断两函数是否相等
{
 if(y==dt2.y && m==dt2.m && d==dt2.d)
  return 1;
 else return 0;
}
void main()          //主函数
{
    int a,b,c,n;
原文请找腾讯752018766辣,文-论'文.网http://www.751com.cn/  date.printDate(date);
 cout<<"输入待比较的日期:"<<endl;
 cin>>a>>b>>c;
 DateType date2(a,b,c);
 cout<<"屏幕输出待比较的日期:"<<endl;
 date2.printDate(date2);
 if(date.equal(date2))
  cout<<"此日期与当前日期相等!"<<endl;
 else
  cout<<"此日期与当前日期不等!"<<endl;
 cout<<"输入在当前日期之上要增加的天数:"<<endl;
 cin>>n;
 for(int i=0;i<n;i++)
 {
  date.incrementDay();
 }
 cout<<"增加"<<n<<"天后的日期是:"<<endl;
 date.printDate(date);