Delphi - Program Menghitung Keliling Persegi Panjang

Bentuk rancangan Form nya adalah seperti berikut :
















Button Hitung
procedure TForm1.Button1Click(Sender: TObject);
var panjang, lebar, keliling : real;
begin
panjang := strtofloat(edit1.Text);
lebar := strtofloat(edit2.Text);
keliling := (panjang+lebar)*2;
edit3.Text:= floattostr(keliling);
end;
Button Reset
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.Text:=' ';
edit2.Text:=' ';
edit3.Text:=' ';
edit1.setFocus;
end;
Button Keluar
procedure TForm1.Button3Click(Sender: TObject);
begin
if (Application.MessageBox('Apakah anda ingin keluar dari aplikasi ?',
'Confirm', MB_YESNO)=ID_YES) then Close;
end;


end.
Share on Google Plus

About Stevanina

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment