![]() |
#2
zhoufeng19882010-12-22 09:16
|

#include<iostream.h>
class runnian
{
public:
runnian();
protected:
int year;
};
runnian::runnian(int t=0)
{
strcpy(year,t);
if(0<t<9999)
{
if((t%4==0&&t%100!=0)||(t%400==0)
cout<<t<<"是闰年"<<endl;
else
cout<<t<<"不是闰年"<<endl;
}
else
reture ERROR:
}
int mian()
{
runnian a;
int y;
cout<<"请输入一个年份:"<<endl;
cin>>y;
a.runnian();
}
自己写的程序,请大家帮忙改改,谢谢!! class runnian
{
public:
runnian();
protected:
int year;
};
runnian::runnian(int t=0)
{
strcpy(year,t);
if(0<t<9999)
{
if((t%4==0&&t%100!=0)||(t%400==0)
cout<<t<<"是闰年"<<endl;
else
cout<<t<<"不是闰年"<<endl;
}
else
reture ERROR:
}
int mian()
{
runnian a;
int y;
cout<<"请输入一个年份:"<<endl;
cin>>y;
a.runnian();
}