Rabu, 24 Agustus 2011

Membuat Kalkulator Sederhana Dengan Delphi 7



procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text:='';
Edit2.Text:='';
Label4.Caption:='';
end;

procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c:Integer;

begin
a:=StrToInt(Edit1.Text);
b:=StrToInt(Edit2.Text);
c:=a+b;
Label4.Caption:=IntToStr(c);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
Edit1.Text:='';
Edit2.Text:='';
Label4.Caption:='';
end;

procedure TForm1.Button2Click(Sender: TObject);
var
a,b,c:Integer;

begin
a:=StrToInt(Edit1.Text);
b:=StrToInt(Edit2.Text);
c:=a-b;
Label4.Caption:=IntToStr(c);

end;

procedure TForm1.Button3Click(Sender: TObject);
var
a,b,c:Integer;

begin
a:=StrToInt(Edit1.Text);
b:=StrToInt(Edit2.Text);
c:=a*b;
Label4.Caption:=IntToStr(c);

end;

procedure TForm1.Button4Click(Sender: TObject);
var
a,b:Integer;
c:Real;

begin
a:=StrToInt(Edit1.Text);
b:=StrToInt(Edit2.Text);
c:=a/b;
Label4.Caption:=FloatToStr(c);

end;

end.
“Selamat Mencoba”

Tidak ada komentar:

Posting Komentar

tolong tinggalkan komentar ya! selamat membaca :D