Rabu, 18 Juli 2012

membuat kalkulator sederahan dari delphi

  
dibawah ini saya akan tuliskan sricpx dan jika teman ingin download silakan klik disini
procedure TForm1.tbbagiClick(Sender: TObject);
var nilai1,nilai2,jumlah: Real;
begin
  nilai1:=StrToFloat(edit1.text);
  nilai2:=StrTofloat(edit2.text);
  jumlah:=nilai1 / nilai2;
  Edit3.Text:=FloatToStr(jumlah);
end;

procedure TForm1.tbkurangClick(Sender: TObject);
var nilai1,nilai2,jumlah: Real;
begin
  nilai1:=StrToFloat(edit1.text);
  nilai2:=StrToFloat(edit2.text);
  jumlah:=nilai1-nilai2;
  Edit3.Text:=FloatToStr(jumlah);
end;

procedure TForm1.tbtambahClick(Sender: TObject);
var nilai1,nilai2,jumlah: Real;
begin
  nilai1:=StrToFloat(edit1.text);
  nilai2:=StrToFloat(edit2.text);
  jumlah:=nilai1+nilai2;
  Edit3.Text:=FloatToStr(jumlah);
end;

procedure TForm1.tbkaliClick(Sender: TObject);
var nilai1,nilai2,jumlah: Real;
begin
  nilai1:=StrToFloat(edit1.text);
  nilai2:=StrToFloat(edit2.text);
  jumlah:=nilai1*nilai2;
  Edit3.Text:=FloatToStr(jumlah);
end;

procedure TForm1.tbmodClick(Sender: TObject);
var nilai1,nilai2,jumlah: Integer;
begin
  nilai1:=StrToInt(edit1.text);
  nilai2:=StrToInt(edit2.text);
  jumlah:=nilai1 mod nilai2;
  Edit3.Text:=IntToStr(jumlah);

end;

procedure TForm1.tbdivClick(Sender: TObject);
var nilai1,nilai2,jumlah: Integer;
begin
  nilai1:=StrToInt(edit1.text);
  nilai2:=StrToInt(edit2.text);
  jumlah:=nilai1 div nilai2;
  Edit3.Text:=IntToStr(jumlah);
end;

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

procedure TForm1.Button8Click(Sender: TObject);
begin
Edit1.Clear;
edit2.Clear;
edit3.Clear;
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
   if not (key in ['0'..'9',#8]) then
   key := #0;
end;

procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
   if not (key in ['0'..'9',#8]) then
   key := #0;

end;


illank bundrank

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 komentar:

Poskan Komentar