Love What You Do, Do What You Love

Program Aljabar Himpunan Menggunakan Delphi 7

Posted by : Unknown
Minggu, 30 Desember 2012


Bagaimana membuat program di atas?
Cukup sediakan entri entri seperti contoh pada gambar. berikut adalah Pseudo Codenya:


Button A irisan B
Var x,y:Integer;
    a,b:Array[0..10] of String;
begin
    For x:=0 to ListBox1.Items.Count-1 do
    a[x]:=ListBox1.Items[x];
    For y:=0 to ListBox2.Items.Count-1 do
    b[y]:=ListBox2.Items[y];
    For x:=0 to ListBox1.Items.Count-1 do
    begin
      For y:=0 to ListBox2.Items.Count-1 do
      if a[x]=b[y] then ListBox3.Items.Add(A[x]);
    end;
end;


Button A gabungan B
Var x,y:Integer;
    a,b:Array[0..100] of String;
    p:Boolean;
begin
    For x:=0 to ListBox1.Items.Count-1 do
    a[x]:=ListBox1.Items[x];
    For y:=0 to ListBox2.Items.Count-1 do
    b[y]:=ListBox2.Items[y];
    For x:=0 to ListBox1.Items.Count-1 do
    ListBox4.Items.Add(A[x]);
    For y:=0 to ListBox2.Items.Count-1 do
    begin
      p:=false;
      For x:=0 to ListBox1.Items.Count-1 do
      if a[x]=b[y] then p:=true;
      if p=false then ListBox4.Items.Add(b[y]);
    end;
end;


Button A+B
Var x,y:Integer;
    a,b:Array[0..100] of String;
    p:Boolean;
begin
    For x:=0 to ListBox1.Items.Count-1 do
    a[x]:=ListBox1.Items[x];
    For y:=0 to ListBox2.Items.Count-1 do
    b[y]:=ListBox2.Items[y];
    For x:=0 to ListBox1.Items.Count-1 do
    begin
      p:=false;
      For y:=0 to ListBox2.Items.Count-1 do
      if a[x]=b[y] then p:=true;
      if p=false then ListBox5.Items.Add(a[x]);
    end;
    For y:=0 to ListBox2.Items.Count-1 do
    begin
      p:=false;
      For x:=0 to ListBox1.Items.Count-1 do
      if a[x]=b[y] then p:=true;
      if p=false then ListBox5.Items.Add(b[y]);
    end;
end;


Button A-B
Var x,y:Integer;
    a,b:Array[0..100] of String;
    p:Boolean;
begin
    For x:=0 to ListBox1.Items.Count-1 do
    a[x]:=ListBox1.Items[x];
    For y:=0 to ListBox2.Items.Count-1 do
    b[y]:=ListBox2.Items[y];
    For x:=0 to ListBox1.Items.Count-1 do
    begin
    p:=false;
    For y:=0 to ListBox2.Items.Count-1 do
    if a[x]=b[y] then p:=true;
    if p=false then ListBox6.Items.add(A[x]);
    end;
end;

Semoga Bermanfaat :)

2 comments:

Faris mengatakan...

gan blh minta source code.a??bingung nich :)

Unknown mengatakan...

silahkaaaan,, seneng banget kalo postingan ini bisa bantu :D

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