Love What You Do, Do What You Love

Program Statistika menggunakan Delphi 7

Posted by : Unknown
Minggu, 30 Desember 2012

Pseudo Code:


BUTTON PROSES
var m,i,z,max,min:integer;
    a:array[1..100] of integer;
begin
  z:=listbox1.items.Count;
  edit2.Text:=inttostr(z);

  for i:= 1 to z do
  a[i]:= strtoint(listbox1.items[i-1]);
  m:=0;

  for i:= 1 to z do
  m:=m+a[i];
  edit3.text:=inttostr(m);
  edit4.text:=floattostr(m/z);

  max:=-2147483647;
  for i:=1 to z do
    if max<a[i] then max:=a[i];
  Edit5.Text:=IntToStr(max);

  min:=2147483647;
  for i:=1 to z do
    if min>a[i] then min:=a[i];
  edit6.text:=inttostr(min);
end;


BUTTON URUTAN DATA
var A:array[0..100] of Integer;
    i,j,k:Integer;
begin
    for i:=0 to ListBox1.Items.Count-1 do
    A[i]:=StrToInt(ListBox1.Items[i]);
    for i:=0 to ListBox1.Items.Count-1 do
    for j:=0 to i do
    if A[i]<A[j]
    then begin
    k:=A[i];
    A[i]:=A[j];
    A[j]:=k;
    end;
    for i:=0 to ListBox1.Items.Count-1 do
    ListBox2.Items.Add(IntToStr(A[i]));
end;

BUTTON MEAN
var A:array[0..100] of Integer;
    i,Jumlah,n:Integer;
    z:Real;
begin
    for i:=0 to ListBox1.Items.Count-1 do
    A[i]:=StrToInt(ListBox1.Items[i]);
    Jumlah:=0;
    for i:=0 to ListBox1.Items.Count-1 do
    Jumlah:=Jumlah+A[i];
    n:=ListBox1.Items.Count;
    z:=Jumlah/n;
    Edit9.Text:=FloatToStr(z);

end;

BUTTON MEDIAN
var a,b,c,m:Integer;
    n:Real;
begin
    a:=StrToInt(Edit2.Text)div 2;
    b:=StrToInt(Edit2.Text)mod 2;
    if b=0 then
    begin
    m:=a;
    n:=(StrToFloat(ListBox2.Items[m])+StrToInt(ListBox2.Items[a-1]))/2;
    Edit10.Text:=FloatToStr(n);
    end
    else
    begin
    c:=StrToInt(Listbox2.Items[a]);
    Edit10.Text:=IntToStr(c);
    end;
end;

BUTTON JANGKAUAN
Var A:array[0..100] of Integer;
    i,M,N,O:Integer;
begin
for i:=0 to ListBox1.Items.Count-1 do
    A[i]:=StrToInt(ListBox1.Items[i]);
    M:=A[0];
    N:=A[0];
    for i:=0 to ListBox1.Items.Count-1 do
    If M<A[i] then M:=A[i];
    If N>A[i] then N:=A[i];
    O:=M-N;
    Edit11.Text:=IntToStr(O);
end;

Semoga Bermanfaat :)

3 comments:

Faris mengatakan...

good share
source code.a blh minta g gan?? :)

Unknown mengatakan...

boleeeeh :D

Unknown mengatakan...

kak, cara nggunain listbox gimana ya?
belum bisa :(

Copyright © 2012 Zuka Zuka World | Hatsune Miku Theme | Designed by Johanes DJ