Monday 5 November 2012

coding program kalkulator dalam bahasa delphi


var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.TambahClick(Sender: TObject);
var EdJumlah : integer;
begin
EdJumlah := StrToInt(Bil_1.Text)+StrToInt(Bil_2.Text);
jml.Text := IntToStr(EdJumlah);
end;

procedure TForm1.KurangClick(Sender: TObject);
var edjumlah : integer;
begin
EdJumlah := StrToInt(Bil_1.Text)-StrToInt(Bil_2.Text);
jml.Text := IntToStr(EdJumlah);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if (application.MessageBox('Anda yakin keluar dari program','Information',mb_yesno)=idyes) then
close;
end;

procedure TForm1.BagiClick(Sender: TObject);
var edjumlah : real;
bil1,bil2 : real;
begin
bil1 := StrToFloat(Bil_1.Text);
bil2 := StrToFloat(bil_2.Text);
EdJumlah := bil1/bil2;
jml.Text := FloatToStr(EdJumlah);
end;

procedure TForm1.KaliClick(Sender: TObject);
var edjumlah : integer;
begin
EdJumlah := StrToInt(Bil_1.Text)*StrToInt(Bil_2.Text);
jml.Text := IntToStr(EdJumlah);
end;

procedure TForm1.div1Click(Sender: TObject);
var edjumlah : integer;
begin
EdJumlah := StrToInt(Bil_1.Text) div StrToInt(Bil_2.Text);
jml.Text := IntToStr(EdJumlah);
end;

procedure TForm1.mod1Click(Sender: TObject);
var edjumlah : integer;
begin
EdJumlah := StrToInt(Bil_1.Text) mod StrToInt(Bil_2.Text);
jml.Text := IntToStr(EdJumlah);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
bil_1.Clear;
bil_2.Clear;
Jml.Clear;
end;

procedure TForm1.Button3Click(Sender: TObject);
var edjumlah : integer;
begin
EdJumlah := StrToInt(Bil_1.Text) * StrToInt(Bil_1.Text);
jml.Text := IntToStr(EdJumlah);
end;

end.

No comments: