
Delphi程序高手请帮帮我。一个关于显示是不是闰年的程序。
我在Delphi中新建了一个窗体,放置了一个Edit组件,一个Label组件,一个Button组件.我想实现的功能是在Edit组件中输入一个年份(比如输入2006)然后通...
我在Delphi中新建了一个窗体,放置了一个Edit组件,一个Label组件,一个Button组件.我想实现的功能是在Edit组件中输入一个年份(比如输入2006)
然后通过单击Button按钮就可以在Label组件中显示该年份是不是闰年.我想请问这个编程代码怎样输入? 展开
然后通过单击Button按钮就可以在Label组件中显示该年份是不是闰年.我想请问这个编程代码怎样输入? 展开
展开全部
procedure TForm1.btn1Click(Sender: TObject);
var
y: integer;
begin
y := StrToInt(edt1.Text);
if (y mod 4 = 0) and (y mod 100 <> 0) or (y mod 400 = 0) then
lbl1.Caption := edt1.Text + '是闰年'
else
lbl1.Caption := edt1.Text + '不是闰年';
end;
var
y: integer;
begin
y := StrToInt(edt1.Text);
if (y mod 4 = 0) and (y mod 100 <> 0) or (y mod 400 = 0) then
lbl1.Caption := edt1.Text + '是闰年'
else
lbl1.Caption := edt1.Text + '不是闰年';
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询