teman-teman, ini nih sintag nya delphi dalam pembuatan program kalkulator sederhana ..
unit KALKULATOR;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Label4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
edit3.Text := inttostr (strtoint (edit1.Text) + strtoint (edit2.Text))
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit3.Text := inttostr (strtoint (edit1.Text) - strtoint (edit2.Text))
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
edit3.Text := inttostr (strtoint (edit1.Text) * strtoint (edit2.Text))
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
edit3.Text := floattostr (strtofloat (edit1.Text) / strtofloat (edit2.Text))
end;
procedure TForm1.Label4Click(Sender: TObject);
begin
Application.terminate;
end;
end.
ini ni hasil program nya
semoga post ini membantu teman-teman semuanya dalam belajar tentang program delphi ...
selamat mencoba :)
Tidak ada komentar:
Posting Komentar