Top Post

Top Post

Posted by : Efdi Minggu, 01 Desember 2013


unit kalkulator;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    procedure Button7Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button7Click(Sender: TObject);
begin
  close
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  Edit1.Text := '';
  Edit2.Text := '';
  Edit3.Text := '';
  Edit1.SetFocus;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  a,b,c:real;
begin
  a:=StrToFloat(edit1.text);
  b:=StrToFloat(edit2.text);
  c:=a+b;
  edit3.Text:=FloatToStr (c);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  a,b,c:real;
begin
  a:=StrToFloat(edit1.text);
  b:=StrToFloat(edit2.text);
  c:=a-b;
  edit3.Text:=FloatToStr (c);
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  a,b,c:real;
begin
  a:=StrToFloat(edit1.text);
  b:=StrToFloat(edit2.text);
  c:=a*b;
  edit3.Text:=FloatToStr (c);
end;

procedure TForm1.Button4Click(Sender: TObject);
var
  a,b,c:real;
begin
  a:=StrToFloat(edit1.text);
  b:=StrToFloat(edit2.text);
  c:=a/b;
  edit3.Text:=FloatToStr (c);
end;

procedure TForm1.Button5Click(Sender: TObject);
var
  a,b,c:integer;
begin
  a:=StrToInt(Edit1.Text);
  b:=StrToInt(Edit2.Text);
  c:= a mod b;
  Edit3.Text := IntToStr(c);
end;

end.

Leave a Reply

Saran dan kritik Anda merupakan semangat bagi kami. Terima kasih...!

Subscribe to Posts | Subscribe to Comments

|| Copyright © 2014 Fakti UPY || Powered by Blogger || Designed by Mbah Jass ||