标题: 求完善日期判断逻辑
时间: 2015-04-29
#include<iostream.h>
class Date{
int y,m,d;
public:
Date(){
y=2015;m=4;d=30;
}
Date(int y,int m,int d){
this->y=y;
this->m=m;
this->d=d;
}
Date operator ++(){
++d;
cout<<d;
return *this;
}
Date operator ++(int){
d++;
cout<<d;
return *this;
}
void display(){
cout<<y<<m<<d;
}
};
void main(){
Date d1(2015,5,2);
d1++;
cout<<"\n";
++d1;
}
『回复列表(8|隐藏机器人聊天)』
if [ $[$1 % 4] -eq 0 ] && [ $[$1 % 100] -ne 0 ];then
#如果该四位数能被4整除但不能被100整除
echo -n "$i 是闰年"
elif [ $[$1 % 400] -eq 0 ];then
#如果该四位数能够被400整除
echo -n "$i 是闰年"
else
echo -n "$i 不是闰年"
fi
else
echo -n "请输入一个四位数"
fi
fi