请教DElphi高手~!~!编程

来源:百度知道 编辑:UC知道 时间:2024/05/15 19:02:58
求解:窗体给一个Label,一个button,一个edit,让在edit输入年分判断是否是闰年,在label中输出,button确认
即刻求解 谢谢

procedure TForm1.button1Click(Sender: TObject);
var
y: integer;
begin
y := StrToInt(edit1.Text);
if (y mod 4 = 0) and (y mod 100 <> 0) or (y mod 400 = 0) then
label1.Caption := edit1.Text + '是闰年'
else
label1.Caption := edit1.Text + '不是闰年';
end;