unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Button_prosedur: TButton;
Button_fungsi: TButton;
BitBtn1: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit_alas: TEdit;
Edit_tinggi: TEdit;
Edit_hasil: TEdit;
procedure h_luas(s,p:string; var hasil_luas:string);
function h_luasf(s,p:string):string;
procedure Button_prosedurClick(Sender: TObject);
procedure Button_fungsiClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
hasil_luas:string;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.h_luas(s,p: string; var hasil_luas: string);
begin
hasil_luas:=FloatToStr(StrToFloat(s)*StrToFloat(p)/2);
end;
function TForm1.h_luasf(s, p: string): string;
begin
h_luasf:=FloatToStr(StrToFloat(s)*StrToFloat(p)/2);
end;
procedure TForm1.Button_prosedurClick(Sender: TObject);
begin
h_luas(Edit_alas.Text,Edit_tinggi.Text,hasil_luas);
Edit_hasil.Text:=hasil_luas;
end;
procedure TForm1.Button_fungsiClick(Sender: TObject);
begin
Edit_hasil.Text:=h_luasf(Edit_alas.Text,Edit_tinggi.Text);
end;
end.
0 komentar:
Posting Komentar