LISTING PROGRAM PERMUTASI DAN KOMBINASI

7
‘’LISTING PROGRAM’’ Form 1 var Form1: TForm1; a,S:integer; implementation uses U_2; {$R *.dfm} procedure TForm1.BitBtn1Click(Sender: TObject); begin form1.visible:=false; form2.visible:=true; end; procedure TForm1.Timer1Timer(Sender: TObject); begin label2.Left := label2.Left - 5; if label2.Left <= -100 then label2.Left := 550; end; procedure TForm1.Timer2Timer(Sender: TObject); begin a:=a+1; if a=1 then label3.Caption:='Tugas Individual'; if a=2 then label4.Caption:='Untuk Memenuhi Tugas Program Komputer'; if a=3 then label5.caption:='Yang Dibina Oleh:'; if a=4 then label6.caption:='Drs. Deddy Sopyan.'; if a=5 then label7.Caption:='Sekolah Tinggi Keguruan dan Ilmu Pendidikan'; if a=6 then label8.Caption:='STKIP- Garut'; if a=7 then label9.Caption:='2010'; if a=8 then begin label3.Caption:=''; label4.Caption:=''; label5.Caption:=''; label6.Caption:=''; label7.Caption:=''; label8.Caption:=''; a:=0; end; S:=S+1; if S=10 then end;

Transcript of LISTING PROGRAM PERMUTASI DAN KOMBINASI

Page 1: LISTING PROGRAM PERMUTASI DAN KOMBINASI

‘’LISTING PROGRAM’’Form 1

var Form1: TForm1;

a,S:integer;implementation

uses U_2;{$R *.dfm}

procedure

TForm1.BitBtn1Click(Sender: TObject);

begin form1.visible:=false; form2.visible:=true;

end;

procedure TForm1.Timer1Timer(Sender:

TObject);

begin label2.Left := label2.Left - 5; if label2.Left <= -100 then

label2.Left := 550;end;

procedure

TForm1.Timer2Timer(Sender: TObject);

begin a:=a+1;

if a=1 then label3.Caption:='Tugas Individual';

if a=2 then label4.Caption:='Untuk Memenuhi Tugas Program

Komputer';if a=3 then label5.caption:='Yang

Dibina Oleh:';if a=4 then label6.caption:='Drs.

Deddy Sopyan.';if a=5 then

label7.Caption:='Sekolah Tinggi Keguruan dan Ilmu Pendidikan';

if a=6 then label8.Caption:='STKIP-Garut';

if a=7 then label9.Caption:='2010';if a=8 then

begin label3.Caption:=''; label4.Caption:=''; label5.Caption:=''; label6.Caption:=''; label7.Caption:=''; label8.Caption:='';

a:=0; end;

S:=S+1;if S=10 then

end;

Page 2: LISTING PROGRAM PERMUTASI DAN KOMBINASI

• Form2• var• Form2: TForm2;•  • implementation• uses U_3;• {$R *.dfm}•  • procedure

TForm2.BitBtn1Click(Sender: TObject);

• begin• If Edit1.Text='izma

cantik' then• form3.show

• else• begin• messagedlg('Password

Anda Salah ! Gunakanlah kata " izma cantik" '+chr(10)+chr(13)+'Coba Sekali Lagi',mtinformation,[mbOK],0);

• edit1.SetFocus;•  end;• end;•  • end.

Page 3: LISTING PROGRAM PERMUTASI DAN KOMBINASI

• Form3• var• Form3: TForm3;•  • implementation• uses U_2, U_4,

U_5, U_6, U_7,U_8,U_9, U_1;

• {$R *.dfm}•  • procedure

TForm3.ampilanBio11Click(Sender: TObject);

• begin• form7.visible:=true

;• end;•  

• procedure TForm3.ampilanBio21Click(Sender: TObject);

• begin• FORM8.VISIBLE:=T

RUE;• end;•  • procedure

TForm3.BiodataPembuat1Click(Sender: TObject);

• begin• FORM9.Visible:=TR

UE;• end;•  • procedure

TForm3.Keluar1Click(Sender: TObject);

• begin• form5.visible:=true

;• end;•  • procedure

TForm3.Keluar2Click(Sender: TObject);

• begin• form1.close;• form2.Close;• form3.Close;• form4.Close;• form5.Close;• form6.Close;• form7.Close;• form8.Close;• form9.Close;• end;

Page 4: LISTING PROGRAM PERMUTASI DAN KOMBINASI

• procedure TForm3.Penutup1Click(Sender: TObject);

• begin• form4.visible:=true;• end;•  • procedure

TForm3.PermutasidanKombinasi1Click(Sender: TObject);

• begin• form6.visible:=true;• end;•  • procedure

TForm3.Timer1Timer(Sender: TObject);

• begin• label1.Left := label1.left - 5;• if label1.top <= -100 then• label1.top := 550;• end ;•  

•  • procedure

TForm3.Timer2Timer(Sender: TObject);

• begin• label2.Left := label2.left - 5;• if label2.top <= -100 then• label2.top := 550;• end;•  • procedure

TForm3.Timer3Timer(Sender: TObject);

• begin• label3.Left := label3.left - 5;• if label3.top <= -100 then• label3.top := 550;• end;•  • end.

Page 5: LISTING PROGRAM PERMUTASI DAN KOMBINASI

• Form 6• procedure

TForm5.Timer1Timer(Sender: TObject);

• begin• a:=a+1;• if a=1 then

label1.Caption:='Terima Kasih ';

• if a=2 then label2.Caption:='Mudah-Mudahan';

• if a=3 then label3.caption:='Tugas yang Saya Buat';

• if a=4 then label4.caption:=' Dapat Bermanfaat';

• if a=5 then• begin• label1.Caption:='';• label2.Caption:='';• label3.Caption:='';• label4.Caption:='';•  • a:=0;• end;• S:=S+1;• if S=5then• end;•  •  • end.

Page 6: LISTING PROGRAM PERMUTASI DAN KOMBINASI

• Form6• var• Form6: TForm6;• a,i,j,k:integer;•

permutasi,kombinasi,fakt1,fakt2,fakt3:array[1..5] of real;

• N,P,NP:array[1..5] of string;• implementation• • {$R *.dfm}• • procedure

TForm6.BitBtn1Click(Sender: TObject);

• begin• if a<=5 then• N[a]:=edit2.Text;• P[a]:=edit3.Text;• NP[a]:=inttostr(strtoint(N[a]) -

strtoint(P[a]));• fakt1[a]:=1;• for i:=2 to strtoint(N[a]) do• fakt1[a]:=fakt1[a]*i;

• fakt2[a]:=1;• for j:=2 to strtoint(P[a]) do• fakt2[a]:=fakt2[a]*j;• fakt3[a]:=1;• for k:=2 to strtoint(NP[a]) do• fakt3[a]:=fakt3[a]*k;• permutasi[a]:=fakt1[a]/fakt3[a];• kombinasi[a]:=fakt1[a]/

(fakt3[a]*fakt2[a]);• edit2.SetFocus;• • if radiobutton1.Checked then• begin• image2.Visible:=true;• label5.Caption:=N[a];• label6.Caption:=P[a];• label7.Caption:=N[a]+'!';• label8.Caption:='('+ N[a]+ ' - '+

P[a]+ ')!';• label9.Caption:=N[a]+'!';• label10.Caption:=NP[a]+'!';•

label11.Caption:=floattostr(fakt1[a]);

• if N[a] >= P[a] then

• begin•

label12.Caption:=floattostr(fakt3[a]);

• label13.Caption:=floattostr(permutasi[a]);

• listbox1.Items.Add(N[a]+ ' Permutasi '+P[a]+ ' = '+ label13.Caption)

• end• else• if N[a] < P[a] then• begin• label12.Caption:='-';• label13.Caption:='Tdk

Terdefinisi';• listbox1.Items.add('Permutasi

tidak terdefinisi, karena (N-R)! atau ('+ N[a]+ '-'+P[a]+')!= '+NP[a]+'! Tidak Terdefinisi');

• end• end• • else

Page 7: LISTING PROGRAM PERMUTASI DAN KOMBINASI

• if radiobutton2.Checked then

• begin•

image2.Visible:=true;

• label5.Caption:=N[a];

• label6.Caption:=P[a];

• label7.Caption:=N[a]+'!';

• label8.Caption:='('+ N[a]+ ' - '+ P[a]+ ')!'+ '.'+ P[a]+ '!';

• label9.Caption:=N[a]+'!';

• label10.Caption:=NP[a]+'!.'+P[a]+ '!';

• label11.Caption:=floattostr(fakt1[a

]);• if N[a] >= P[a]

then• begin

label12.Caption:=floattostr(fakt3[a]*fakt2[a]);

• label13.Caption:= floattostr(kombinasi[a]);

• listbox1.Items.Add(N[a]+ ' Kombinasi '+P[a]+ ' = '+ label13.Caption)

• end• else• if N[a] < P[a]

then• begin•

label12.Caption:='-';

• label13.Caption:='Tdk Terdefinisi';

• listbox1.Items.ad

d('Kombinasi tidak terdefinisi, karena (N-R)! atau ('+ N[a]+ '-'+P[a]+')!= '+NP[a]+'! Tidak Terdefinisi');

• end• end; • if a<5 then• begin• a:=a+1;•

edit1.Text:=inttostr(a);

• edit2.Text:='';• edit3.Text:='';• end• else if a=5 then•

messagedlg('STOP !!!'+chr(10)+chr(13)+'DATA SUDAH PENUH',mtinformation,[mbOk],0);

•  • end;