image1 image2

BUBURBULATです |WELCOME TO MY PERSONAL BLOG|数学と芸術が大好き

Himpunan

Irisan

procedure TForm11.Button3Click(Sender: TObject);
var
  a,d:array [0 ..100] of string;
  b,c:integer;
begin
    for b:= 0 to listbox1.Items.Count-1 do
    a[b]:= (listbox1.Items[b]);
    for c:=0 to listbox2.Items.count-1 do
    d[c]:= (listbox2.Items[c]);
   for b:= 0 to listbox1.Items.Count-1 do
   begin
   for c:=0 to listbox2.Items.Count-1 do
    if a[b] = d[c] then
  listbox3.Items.add(a[b]);
  end;
end;
Gabungan
 procedure TForm11.Button4Click(Sender: TObject);
var i,j:integer;
a,b: array [0..10]of string;
iris:boolean;
begin
  for i := 0 to listbox1.items.count-1 do
  a[i]:=listbox1.items[i];
  for j := 0 to listbox2.items.count-1 do
  b[j]:=listbox2.items[j];
  for i := 0 to listbox1.items.count-1 do
  listbox4.items.add(a[i]);
  for j := 0 to listbox2.items.count-1 do
   begin
   iris :=false;
   for i := 0 to listbox1.items.count-1 do
  if a[i]= b[j] then iris:= true ;
  if iris = false then listbox4.items.add(b[j]);
  end;
end;
Penjumlahan (A+B)
 procedure TForm11.Button5Click(Sender: TObject);
var
  a,d:array [0 ..100] of string;
  b,c:integer;
  x:boolean;
begin
    for b:= 0 to listbox1.Items.Count-1 do
    a[b]:= (listbox1.Items[b]);
    for c:=0 to listbox2.Items.count-1 do
    d[c]:= (listbox2.Items[c]);
    for b:= 0 to listbox1.Items.Count-1 do
     begin
     x:= false;
     for c:=0 to listbox2.Items.Count-1 do
    if a[b] =  d[c] then x:= true;
    if x=false then
  listbox5.Items.add(a[b]);
  end;
  for b:=0 to listbox2.Items.Count-1 do
    if a[b] =  d[c] then x:= true;
    if x=false then
  listbox6.Items.add(d[c]);
  end;

Pengurangan (A-B)
 procedure TForm11.Button6Click(Sender: TObject);
var
  a,d:array [0 ..100] of string;
  b,c:integer;
  x:boolean;
begin
    for b:= 0 to listbox1.Items.Count-1 do
    a[b]:= (listbox1.Items[b]);
    for c:=0 to listbox2.Items.count-1 do
    d[c]:= (listbox2.Items[c]);
    for b:= 0 to listbox1.Items.Count-1 do
     begin
     x:= false;
     for c:=0 to listbox2.Items.Count-1 do
    if a[b] =  d[c] then x:= true;
    if x=false then
  listbox6.Items.add(a[b]);
   end;
 end;
Komplemen (A komplemen B)
 procedure TForm11.Button7Click(Sender: TObject);
Var
i,j:Integer;
S,A:Array[0..100] of String;
ada:Boolean;
begin
For i:=0 to ListBox1.Items.Count-1 do
S[i]:=ListBox1.Items[i];
For j:=0 to ListBox2.Items.Count-1 do
A[j]:=ListBox2.Items[j];
For i:=0 to ListBox1.Items.Count-1 do
begin
ada:=false;
For j:=0 to ListBox2.Items.Count-1 do
if S[i]=A[j] then ada:=true;
if ada=false then ListBox7.Items.Add(S[i]);

end;
 end;

Share this:

CONVERSATION

0 komentar:

Post a Comment