You are on page 1of 24

1.

Program Aplikasi Array

var Form1: TForm1; implementation uses Unit2; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin if edit1.Text=edit2.text then begin form2.show

end else messagedlg('Password Yang Anda Masukkan Tidak Cocok'+chr(13)+'Coba Anda Ulangi',mtConfirmation,[mbYes],0); edit1.Clear; edit2.Clear; edit1.SetFocus; end; end. 2. menu

var

Form2: TForm2; implementation uses Unit6, Unit3, Unit4, Unit5, Unit7; {$R *.dfm} procedure TForm2.Array1Click(Sender: TObject); begin form6.show; end; procedure TForm2.Biodata1Click(Sender: TObject); begin form3.show; end; procedure TForm2.Close1Click(Sender: TObject); begin application.terminate end;

procedure TForm2.InputOutputData1Click(Sender: TObject); begin form4.show; end; procedure TForm2.Matriks1Click(Sender: TObject); begin

form5.show; end; procedure TForm2.Matriks2Click(Sender: TObject); begin form7.show; end; procedure TForm2.Timer1Timer(Sender: TObject); begin label1.Caption:=datetostr(now); label2.Caption:=timetostr(now); end; end.
3.

Biodata

var Form3: TForm3; implementation {$R *.dfm} procedure TForm3.BitBtn1Click(Sender: TObject); begin shape1.Visible:=false; listbox1.Visible:=false; listbox1.Clear; image3.Visible:=false;

combobox1.text:=''; end; procedure TForm3.BitBtn2Click(Sender: TObject); begin close; end; procedure TForm3.Button1Click(Sender: TObject); begin if combobox1.ItemIndex=2 then begin shape1.Visible:=true; listbox1.Visible:=true; listbox1.Items.Add('NAMA : HERI HERYANTO'); listbox1.Items.Add('NIM : 0951'); listbox1.Items.Add('JURUSAN : PENDIDIKAN MATEMATIKA'); listbox1.Items.Add('TTL : GARUT,'); listbox1.Items.Add('AGAMA : ISLAM'); listbox1.Items.Add('ALAMAT : '); listbox1.Items.Add('E-MAIL : '); image3.Visible:=true; end else end;

end.

4.

Input Autput Data

var Form4: TForm4; implementation {$R *.dfm} procedure TForm4.Button1Click(Sender: TObject); type input_data = record nim: longint; nama: string;

jurusan: string; alamat: string; nope: string; email: string; end;

var data : array [1..100] of Input_data; n,i : integer; begin n:=STRTOINT(Edit1.text); for i:= 1 to n do begin data[i].nim:=StrToInt(InputBox('NIM','MASUKKAN NIM','')); data[i].nama:=InputBox('NAMA','MASUKKAN NAMA',''); data[i].jurusan:=inputbox('JURUSAN','MASUKKAN JURUSAN',''); data[i].alamat:=inputbox('ALAMAT','MASUKKAN ALAMAT',''); data[i].nope:=inputbox('NOMOR TELEPON','MASUKKAN NOMOR TELEPON',''); data[i].email:=inputbox('E-MAIL','MASUKKAN E-MAIL',''); listbox1.Items.add('Data Ke :'+inttostr(i)); listbox1.Items.add('Nim :'+#9+inttostr(data[i].nim)); listbox1.Items.add('Nama :'+#9+(data[i].nama));

listbox1.Items.add('Jurusan :'+#9+(data[i].jurusan)); listbox1.Items.add('Alamat :'+#9+(data[i].alamat)); listbox1.Items.add('Nomor Telepon :'+#9+(data[i].nope)); listbox1.Items.add('E-mail :'+#9+(data[i].email)); listbox1.Items.add('============================================= ===='); end; end; procedure TForm4.Button2Click(Sender: TObject); begin edit1.Clear; listbox1.Clear; end; procedure TForm4.Button3Click(Sender: TObject); begin close; end; end.

5.

matrik

var Form5: TForm5; i,j,k : integer; data1 : array [1..10, 1..10] of integer; data2 : array [1..10, 1..10] of integer; hasil : array [1..10, 1..10] of integer; implementation {$R *.dfm} procedure TForm5.BitBtn1Click(Sender: TObject);

begin stringgrid3.Cells[1, 1] := ''; StringGrid3.Cells[1, 2] := ''; StringGrid3.Cells[1, 3] := ''; StringGrid3.Cells[1, 4] := ''; StringGrid3.Cells[1, 5] := ''; StringGrid3.Cells[2, 1] := ''; StringGrid3.Cells[2, 2] := ''; StringGrid3.Cells[2, 3] := ''; StringGrid3.Cells[2, 4] := ''; StringGrid3.Cells[2, 5] := ''; StringGrid3.Cells[3, 1] := ''; StringGrid3.Cells[3, 2] := ''; StringGrid3.Cells[3, 3] := ''; StringGrid3.Cells[3, 4] := ''; StringGrid3.Cells[3, 5] := ''; StringGrid3.Cells[4, 1] := ''; StringGrid3.Cells[4, 2] := ''; StringGrid3.Cells[4, 3] := ''; StringGrid3.Cells[4, 4] := ''; StringGrid3.Cells[4, 5] := ''; StringGrid3.Cells[5, 1] := ''; StringGrid3.Cells[5, 2] := '';

StringGrid3.Cells[5, 3] := ''; StringGrid3.Cells[5, 4] := ''; StringGrid3.Cells[5, 5] := ''; end; procedure TForm5.Button1Click(Sender: TObject); var i,j,k : integer; data1 : array [1..10, 1..10] of integer; data2 : array [1..10, 1..10] of integer; hasil : array [1..10, 1..10] of integer; begin if RadioButton1.checked then begin if (edit1.Text = edit3.Text) and (edit2.Text = edit4.Text) then begin for i := 1 to strtoint(edit1.Text) do begin StringGrid1.Cells[0,i] :='B' + InttoStr(i); StringGrid2.Cells[0,i] := 'B' + InttoStr(i); StringGrid3.Cells[0,i] := 'B' + InttoStr(i); for j:= 1 to strtoint(edit2.Text) do begin StringGrid1.Cells[i,0] := 'K' + InttoStr(i);

StringGrid2.Cells[i,0] := 'K' + InttoStr(i); StringGrid3.Cells[i,0] := 'K' + InttoStr(i); StringGrid3.Cells[i,j] := ''; data1[i,j] := StrtoInt(StringGrid1.Cells[i,j]); data2[i,j] := StrtoInt(StringGrid2.Cells[i,j]); Hasil[i,j] := data1[i,j] + data2[i,j]; stringGrid3.RowCount := strtoint(edit1.Text)+1; stringGrid3.ColCount := strtoint(edit2.Text)+1; StringGrid3.Cells[i,j] := inttostr(Hasil[i,j]); end; end; end else showmessage('Ukuran Matriks Tidak sama'); edit1.SetFocus; end; if RadioButton2.checked then begin if ((edit2.Text) = (edit3.Text)) then begin for i := 1 to StrtoInt(Edit1.Text) do for j:= 1 to StrtoInt(Edit4.Text) do begin

Hasil[i,j] := 0; for k:= 1 to StrtoInt(Edit2.Text) do begin data1[i,k] := StrtoInt(StringGrid1.Cells[k,i]); data2[k,j] := StrtoInt(StringGrid2.Cells[j,k]); Hasil [i,j] := Hasil[i,j] + data1[i,k] * data2[k,j]; StringGrid3.RowCount := StrtoInt(edit1.Text) + 1; StringGrid3.ColCount := StrtoInt(edit4.Text) + 1; end; StringGrid3.Cells[j,i] := inttostr(Hasil[i,j]); end; end else begin showmessage('Ukuran Matriks Tidak Sesuai'); edit2.SetFocus; end; end; if RadioButton3.checked then begin stringGrid3.RowCount := strtoint(edit2.Text)+1; stringGrid3.ColCount := strtoint(edit1.Text)+1; for i := 1 to strtoint(edit2.Text) do

begin for j:= 1 to strtoint(edit1.Text) do StringGrid3.Cells[j,i] := StringGrid1.Cells[i,j]; end; end; if RadioButton4.checked then begin stringGrid3.RowCount := strtoint(edit4.Text)+1; stringGrid3.ColCount := strtoint(edit3.Text)+1; for i := 1 to strtoint(edit4.Text) do begin for j:= 1 to strtoint(edit3.Text) do StringGrid3.Cells[j,i] := StringGrid2.Cells[i,j]; end; end; end; procedure TForm5.Button2Click(Sender: TObject); begin close; end; procedure TForm5.Edit1Change(Sender: TObject); begin stringGrid1.RowCount := strtoint(edit1.Text)+1;

if (strtoint(edit1.Text)) > 6 then Begin StringGrid1.DefaultRowHeight := 15; StringGrid3.DefaultRowHeight := 15; end; end; procedure TForm5.Edit2Change(Sender: TObject); begin stringGrid1.ColCount := strtoint(edit2.Text)+1; if (strtoint(edit2.Text)) > 6 then begin StringGrid1.DefaultColWidth := 30; StringGrid3.DefaultColWidth := 30; end; end; procedure TForm5.Edit3Change(Sender: TObject); begin stringGrid2.RowCount := strtoint(edit3.Text)+1; if (strtoint(edit3.Text)) > 6 then Begin StringGrid2.DefaultRowHeight := 15; StringGrid3.DefaultRowHeight := 15; end;

end; procedure TForm5.Edit4Change(Sender: TObject); begin stringGrid2.ColCount := strtoint(edit4.Text)+1; if (strtoint(edit4.Text)) > 6 then begin StringGrid2.DefaultColWidth := 30; StringGrid3.DefaultColWidth := 30; end; end; procedure TForm5.FormCreate(Sender: TObject); begin StringGrid1.Cells[1, 1] := '1'; StringGrid1.Cells[1, 2] := '0'; StringGrid1.Cells[1, 3] := '0'; StringGrid1.Cells[1, 4] := '0'; StringGrid1.Cells[1, 5] := '0'; StringGrid1.Cells[2, 1] := '0'; StringGrid1.Cells[2, 2] := '1'; StringGrid1.Cells[2, 3] := '0'; StringGrid1.Cells[2, 4] := '0'; StringGrid1.Cells[2, 5] := '0'; StringGrid1.Cells[3, 1] := '0';

StringGrid1.Cells[3, 2] := '0'; StringGrid1.Cells[3, 3] := '1'; StringGrid1.Cells[3, 4] := '0'; StringGrid1.Cells[3, 5] := '0'; StringGrid1.Cells[4, 1] := '0'; StringGrid1.Cells[4, 2] := '0'; StringGrid1.Cells[4, 3] := '0'; StringGrid1.Cells[4, 4] := '1'; StringGrid1.Cells[4, 5] := '0'; StringGrid1.Cells[5, 1] := '0'; StringGrid1.Cells[5, 2] := '0'; StringGrid1.Cells[5, 3] := '0'; StringGrid1.Cells[5, 4] := '0'; StringGrid1.Cells[5, 5] := '1'; StringGrid2.Cells[1, 1] := '5'; StringGrid2.Cells[1, 2] := '5'; StringGrid2.Cells[1, 3] := '5'; StringGrid2.Cells[1, 4] := '5'; StringGrid2.Cells[1, 5] := '5'; StringGrid2.Cells[2, 1] := '4'; StringGrid2.Cells[2, 2] := '4'; StringGrid2.Cells[2, 3] := '4'; StringGrid2.Cells[2, 4] := '4';

StringGrid2.Cells[2, 5] := '4'; StringGrid2.Cells[3, 1] := '3'; StringGrid2.Cells[3, 2] := '3'; StringGrid2.Cells[3, 3] := '3'; StringGrid2.Cells[3, 4] := '3'; StringGrid2.Cells[3, 5] := '3'; StringGrid2.Cells[4, 1] := '2'; StringGrid2.Cells[4, 2] := '2'; StringGrid2.Cells[4, 3] := '2'; StringGrid2.Cells[4, 4] := '2'; StringGrid2.Cells[4, 5] := '2'; StringGrid2.Cells[5, 1] := '1'; StringGrid2.Cells[5, 2] := '1'; StringGrid2.Cells[5, 3] := '1'; StringGrid2.Cells[5, 4] := '1'; StringGrid2.Cells[5, 5] := '1'; end; procedure TForm5.RadioButton1Click(Sender: TObject); begin GroupBox2.Caption :='Hasil Penjumlahan Matriks A dan B'; end; procedure TForm5.RadioButton2Click(Sender: TObject); begin

GroupBox2.Caption :='Hasil Penjumlahan Matriks A dan B'; end; procedure TForm5.RadioButton3Click(Sender: TObject); begin GroupBox2.Caption :='Hasil Matriks Transpode dari A'; end; procedure TForm5.RadioButton4Click(Sender: TObject); begin GroupBox2.Caption :='Hasil Matriks Transpode dari B'; end; end.

6.

array

var Form6: TForm6; implementation {$R *.dfm} procedure TForm6.Button1Click(Sender: TObject); begin image2.Visible:=true; image1.Visible:=false; image3.Visible:=false;

end; procedure TForm6.Button2Click(Sender: TObject); begin image2.Visible:=false; image1.Visible:=true; image3.Visible:=false; end; procedure TForm6.Button3Click(Sender: TObject); begin image1.Visible:=false; image2.Visible:=false; image3.Visible:=true; end; procedure TForm6.Button4Click(Sender: TObject); begin close; end; procedure TForm6.Button5Click(Sender: TObject); begin image1.Visible:=false; image2.Visible:=false; image3.Visible:=false; end;

end.

7.

Matrik

var Form7: TForm7; implementation {$R *.dfm} procedure TForm7.Button1Click(Sender: TObject); begin image1.Visible:=true;

end; procedure TForm7.Button2Click(Sender: TObject); begin image1.Visible:=false; end; procedure TForm7.Button3Click(Sender: TObject); begin close; end; end.

You might also like