Melihat tahun kabisat dengan delphi
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
bln:integer;
thn:integer;
begin
bln:=strtoint(edit1.Text);
case bln of
1:label3.Caption:='januari';
2:label3.Caption:='Februari';
3:label3.Caption:='Maret';
4:label3.Caption:='April';
5:label3.Caption:='Mei';
6:label3.Caption:='Juni';
7:label3.Caption:='Juli';
8:label3.Caption:='Agustus';
9:label3.Caption:='September';
10:label3.Caption:='Oktober';
11:label3.Caption:='November';
12:label3.Caption:='Desember';
else
showmessage('masukan anda salah');
end;
begin
thn:=strtoint(edit2.Text);
if(thn mod 4)=0 then
begin
label4.caption:='tahun kabisat';
end
else
begin
label4.Caption:='tidak tahun kabisat';
end;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
bln:integer;
thn:integer;
begin
bln:=strtoint(edit1.Text);
case bln of
1:label3.Caption:='januari';
2:label3.Caption:='Februari';
3:label3.Caption:='Maret';
4:label3.Caption:='April';
5:label3.Caption:='Mei';
6:label3.Caption:='Juni';
7:label3.Caption:='Juli';
8:label3.Caption:='Agustus';
9:label3.Caption:='September';
10:label3.Caption:='Oktober';
11:label3.Caption:='November';
12:label3.Caption:='Desember';
else
showmessage('masukan anda salah');
end;
begin
thn:=strtoint(edit2.Text);
if(thn mod 4)=0 then
begin
label4.caption:='tahun kabisat';
end
else
begin
label4.Caption:='tidak tahun kabisat';
end;
end;
end;
end.
Komentar
Posting Komentar