tygrysek84
29.11.05, 22:22
program RoznicaZb;
const zbior = 10;
type zb = record
liczba : array [1..zbior] of integer;
{elementy zbioru}
poz : array [1..zbior] of boolean;
calyZbior : integer;
end;
procedure st(var X: zb);
{normalizacja}
var i, j: integer;
begin
for i:=1 to -1 do
if (X.poz[i]=true) then
for j:=i+1 to zbior do
if (X.poz[j]=true) and (X.liczba[i]=X.liczba[j]) then begin
X.poz[j]:=false;
Dec(X.calyZbior);
end;
end;
procedure LosLicz(var X: zb);
var i: integer;
begin
for i:=1 to zbior do begin
X.liczba[i]:=random(zbior)-(zbior mod 2);
X.poz[i]:=true;
end;
X.calyZbior:=zbior;
st(X);
end;
procedure Odejmij(X, Y: zb; var Z: zbior);
var i :integer;
begin
for i:=1 to zbior do
if X.liczba[i] = Y.liczba[i] then
begin
X.pos[i] := false;
Z.pos[i] := false;
end else
begin
Z.liczba[i] := X.liczba[i];
Z.pos[i] := true;
end;
Z.calyzbior := 0;
for i:=1 to zbior do
if Z.pos[i] = true then inc(Z.calyzbior);
end;
procedure DrukujZbior(X: zb);
var i: integer;
begin
for i:=1 to zbior do
if (X.poz[i]=TRUE) then write(X.liczba[i]:3);
Writeln;
Writeln;
end;
var A,B,C: zb;
begin
Randomize;
LosLicz(A);
LosLicz(B);
DrukujZbior(A);
DrukujZbior(B);
readln;
end.
kto mi pomoze to poprawic? procedura odejmij coś niw bardzo chce działac:(
Program ma liczyć róznice dwóch zbiorów liczbowych i musi zaczynac sie od tego
recordu na górze...
ja już nie mam pojecia co tam jest nie tak:((
z góry dzieki:)