Program luas segitiga 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;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
alas,tinggi,luas:real;
begin
alas :=StrToFloat(Edit1.Text);
tinggi :=StrToFloat(Edit2.Text);
luas :=alas*tinggi*0.5;
Edit3.Text :=FloatToStr(luas);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
application.terminate
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;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
alas,tinggi,luas:real;
begin
alas :=StrToFloat(Edit1.Text);
tinggi :=StrToFloat(Edit2.Text);
luas :=alas*tinggi*0.5;
Edit3.Text :=FloatToStr(luas);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
application.terminate
end;
end.
Komentar
Posting Komentar