unit IsLeapYear;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses DateUtils;

// BeginExample: IsLeapYear
// Routine: SysUtils.IsLeapYear

// BeginCode
{
This example requires a button and a text edit. When the
user presses the button a message indicates if the year
specified in the text edit is a leap year.
}
function IsThisLeapYear(year : Word): Boolean;
begin
  Result := SysUtils.IsLeapYear(year);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  year : integer;
begin
  year := StrToInt(Edit1.Text);
  if (IsThisLeapYear(year)) then
    ShowMessage(Edit1.Text + ' is a leap year.')
  else
    ShowMessage(Edit1.Text + ' is not a leap year.');
end;
// EndCode
// EndExample: IsLeapYear
end.
