Intro Delphi 7
Sudah lama saya tak posting di blog
yang satu ini, okee kali ini saya ingin membagikan sebuah ilmu yang bisa
kita pelajari atau untuk kalian sebagai contoh pembuatan program di Delphi 7 dan sekaligus sebagai arsip bagi saya sendiri.
Untuk penjelasan kodingannya dan laporan akhir silahkan download disini.
LISTING
PROGRAM
Form1
=============================================================
procedure
TForm1.Button1Click(Sender: TObject);
var
nilai :
Integer;
begin
nilai :=
StrToInt(Edit2.Text);
if nilai <
30 then
Edit3.Text:='Kalah'
else if nilai
<= 50 then
Edit3.Text:='Juara Harapan'
else if nilai
<=70 then
Edit3.Text:='Juara 3'
else if nilai
<=90 then
Edit3.Text:='Juara 2'
else if nilai
<=100 then
Edit3.Text:='Juara 1'
else
Edit3.Text:='Tidak Ada';
Label4.Caption:=Edit1.Text+chr(13)+Edit2.Text+chr(13)+Edit3.Text;
end;
________________________________________________________________
procedure
TForm1.Button2Click(Sender: TObject);
begin
Edit1.Text:='
';
Edit2.Text:='
';
Edit3.Text:='
';
Label4.Caption:='';
end;
________________________________________________________________
procedure
TForm1.Button3Click(Sender: TObject);
begin
if
Application.MessageBox('Yakin kamu mau keluar ?','Peringatan', MB_YesNo)=ID_Yes
then
Application.Terminate;
end;
________________________________________________________________________
procedure
TForm1.Button4Click(Sender: TObject);
begin
form2.Show;
form1.Hide;
end;
end.
================================================================
Form2
procedure
TForm2.Button1Click(Sender: TObject);
var
a,b :
integer;
begin
Memo1.Lines.Clear;
a:=StrToInt(Edit1.Text);
for b:=1 to
StrToInt(Edit2.Text) do
begin
Memo1.Lines.Add('Perulangan
to-'+IntToStr(b)+'='+IntToStr(a));
a:=a+1;
end;
end;
________________________________________________________________
procedure
TForm2.Button2Click(Sender: TObject);
var
a,b : integer;
begin
Memo1.Lines.Clear;
a:=StrToInt(Edit1.Text);
b:=1;
for a:=a
DownTo(StrToInt(Edit1.Text)-StrToInt(Edit2.Text)+1)do
begin
Memo1.Lines.Add('Perulangan Ke-
'+IntToStr(b)+'='+IntToStr(a));
b:=b+1;
end;
end;
________________________________________________________________
procedure
TForm2.Button3Click(Sender: TObject);
var
a,b:integer;
begin
Memo1.Clear;
a:=StrToInt(Edit1.Text);
b:=0;
while b
<> StrToInt(Edit2.Text) do
begin
Memo1.Lines.Add('Perulangan Ke-
'+IntToStr(b+1)+'='+IntToStr(a));
a:=a+1;
b:=b+1;
end;
end;
________________________________________________________________
procedure
TForm2.Button4Click(Sender: TObject);
var
a,b :
integer;
begin
Memo1.Clear;
a:=StrToInt(Edit1.Text);
b:=0;
repeat
Memo1.Lines.Add('Perulangan to-
'+IntToStr(b+1)+'='+IntToStr(a));
a:=a+1;
b:=b+1;
until b =
StrToInt(Edit2.Text)
end;
________________________________________________________________
procedure
TForm2.Button5Click(Sender: TObject);
begin
if
Application.MessageBox('Yakin kamu mau keluar ?','Peringatan', MB_YesNo)=ID_Yes
then
Application.Terminate;
end;
end.
=============================================================
OUTPUT
PROGRAM
Klik Proses
Klik Delete
Klik Keluar
Klik For to do
Klik For down to do
Klik While do
Klik Repeat until
Klik Close
Untuk penjelasan kodingannya dan laporan akhir silahkan download disini.
Komentar
Posting Komentar
Mari tukar pendapat, tapi jangan tukar pendapatan ;)