You are on page 1of 2

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type

TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; ListBox1: TListBox; ListBox2: TListBox; ListBox3: TListBox; ListBox4: TListBox; Button2: TButton; Label8: TLabel; Label9: TLabel; Edit4: TEdit; Edit5: TEdit; procedure FormActivate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; a_nama:array[1..5]of string; a_ipa,a_ips,a_jumlah:array[1..5]of integer; baris,i: integer; nama:string; nilaitertinggi:integer; implementation

{$R *.dfm} procedure TForm1.FormActivate(Sender: TObject); begin baris:=0; end; procedure TForm1.Button1Click(Sender: TObject); begin baris:=baris+1; a_nama[baris]:=edit1.Text; listbox1.AddItem(edit1.Text,listbox1); a_ipa[baris]:=strtoint(edit2.Text); listbox2.AddItem(edit2.Text,listbox2); a_ips[baris]:=strtoint(edit3.Text); listbox3.AddItem(edit3.Text,listbox3); a_jumlah[baris]:=a_ipa[baris]+a_ips[baris]; listbox4.AddItem(inttostr(a_jumlah[baris]),listbox4); end; procedure TForm1.Button2Click(Sender: TObject); begin nama:=a_nama[i]; nilaitertinggi:=a_jumlah[i]; for i:=2 to baris do begin if nilaitertinggi>a_jumlah[i] then begin edit4.Text:=a_nama[i]; edit5.Text:=inttostr(a_jumlah[i]); end; end; end; end.

You might also like