Program
Perulangan dan Pangkat
1.Form
: Misbahul Munir
2.Design
Form
3.Listing
Program
procedure
TForm1.ForToDoClick(Sender: TObject);
var
i,j:integer;b:string;
begin
b:='';j:=2;
for
i:=1 to 10 do
begin
b:=b+inttostr(i)+'';
j:=j+2;
end;
label1.Caption:=b;
end;
procedure
TForm1.ForDowntoDoClick(Sender: TObject);
var
i,j:integer;b:string;
begin
b:='';j:=2;
for
i:=10 downto 1 do
begin
b:=b+inttostr(i)+'';
j:=j+2;
end;
label2.caption:=b;
end;
procedure
TForm1.WhileDoClick(Sender: TObject);
var
i,j:integer;b:string;
begin
i:=1;
b:='';
while
i<=10 do
begin
b:=b+inttostr(i)+'';
i:=i+1;
end;
label3.Caption:=b;
end;
procedure
TForm1.RepeatUntilClick(Sender: TObject);
var
i,j:integer;b:string;
begin
i:=1;
b:='';
repeat
b:=b+inttostr(i)+'';
i:=i+1;
until i>10;
label4.caption:=b;
end;
procedure
TForm1.bt_pangkatClick(Sender: TObject);
var
bil,hasil,pangkat,a:integer;
begin
bil:=strtoint(edit1.Text);
hasil:=bil;
pangkat:=strtoint(edit2.Text);
if
edit2.text='0'then edit3.Text:='1'else
if
edit2.text='1'then edit3.Text:=edit1.text else
begin
for
a:=2 to pangkat do
hasil:=hasil*bil;
edit3.Text:=inttostr(hasil);
lnama.Caption:='Misbahul Munir';
lnim.Caption:='111221067';
end;
end;
procedure
TForm1.BinputClick(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.clear;
lnama.caption:='';
lnim.Caption:='';
label1.Caption:='';
label2.Caption:='';
label3.Caption:='';
label4.Caption:='';
end;
procedure
TForm1.btKeluarClick(Sender: TObject);
begin
if(application.MessageBox('ingin
keluar dari tugas munirmaestro ?','konfirmasi',mb_yesno)=idyes)then
close;
end;
procedure
TForm1.timer1timer(Sender: TObject);
begin
Timer1.Enabled := true;
Label7.Left
:= Label7.Left + 10;
if
Label7.Left > 340 then
Label7.Left
:= -345;
end;
4.Tampilan
Run Perulangan dan Pangkat
Download
Program Setup.... Munir Setup.exe
Password sms saya ke 085855556776
Tidak ada komentar:
Posting Komentar