sor: url("http://downloads.totallyfreecursors.com/thumbnails/banana1.gif

Sabtu, 21 April 2012

Contoh Program Delphi



unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
E,F : integer;
begin
Memo1.clear;
E:= strtoint (edit1.Text);
F:=1;
while F <> strtoint (edit2.Text) do
begin
Memo1.Lines.add ('Perulangan ke-'+ inttostr(F)+ '=' + inttostr (E));
E := E+1;
F := F+1;
end;

end;

procedure TForm1.Button2Click(Sender: TObject);
var
E, F : integer;
begin
Memo1.Clear;
E:= strtoint (edit1.Text);
for F:= 1 to strtoint (edit2.Text) do
begin
Memo1.Lines.add (' Perulangan ke-'+ inttostr (F)+ '='+ inttostr (E));
E:= E+1;
end;

end;

procedure TForm1.Button3Click(Sender: TObject);
var
E, F , A : integer;
begin
Memo1.Clear;
E:= strtoint (edit1.Text);
for f := E to strtoint (edit2.text) do
begin
A:= sqr (F);
Memo1.lines.Add ( inttostr (F) + 'Kuadrat'+ '='+ inttostr (A));
end; 
end;

end.

Tidak ada komentar:

Posting Komentar