CARA MEMBUAR KALKULATOR PADA DELPHI 7
1. Buka aplikasi delphi 7
2.Klik simbol EDIT untuk menambah Edit1,Edit2,Edit3

Hingga muncul seperti ini
3. Klik tombol OK sebanyak 4 kali untuk membuat Button seperti gambar dibawah ini
4.Ganti caption Button1 dengan "+",Button2 dengan"-"Button3 dengan" X", dan Button4 dengan ''/''
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;
end.
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;
end.
6. Kemudian tekan F9 untuk menjalankan program
Dan jadilah seperti gamabr berikut
''SEKIAN TERIMA KASIH SEMOGA DAPAT BERMANFAAT''




Komentar
Posting Komentar