Luas Segi Tiga Dengan Lazarus ( For Mas Rifki )

Untuk membuat aplikasi penghitung luas segitiga, siapkan Tedit, Button Dan Label. Buat seperti gambar di bawah ini (Di lingkari).

Kemudian Klik 2x pada button dan isikan kode yang dicetak tebal di bawah. Semoga berhasil.
lazarus-luas segitiga

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

{ TForm1 }

TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
alas,tinggi,kecil,sedang:integer;
luas :single;
begin
alas:=StrToInt(Edit1.Text);
tinggi:=StrToInt(Edit2.Text);
luas:=alas*tinggi/2;
Edit3.Text:=FloatToStr(luas);
end;

end.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s