program RationalEquations;
uses crt;
var
eqCounter, coefficientX, coefficientY, constant: integer;
equations: array [1..10000, 1..3] of integer;
isUnique: boolean;
function GenerateRandomCoefficients: integer;
begin
GenerateRandomCoefficients := Random(9) + 1;
end;
function CheckUniqueness(newEquation: array[1..3] of integer): boolean;
var
i: integer;
begin
CheckUniqueness := True;
for i := 1 to eqCounter do
begin
if (equations[i, 1] = newEquation[1]) and (equations[i, 2] = newEquation[2]) and (equations[i, 3] = newEquation[3]) then
begin
CheckUniqueness := False;
Exit;
end;
end;
end;
begin
Randomize;
clrscr;
eqCounter := 0;
while eqCounter < 10000 do
begin
coefficientX := GenerateRandomCoefficients;
coefficientY := GenerateRandomCoefficients;
constant := GenerateRandomCoefficients;
isUnique := CheckUniqueness([coefficientX, coefficientY, constant]);
if isUnique then
begin
Inc(eqCounter);
equations[eqCounter, 1] := coefficientX;
equations[eqCounter, 2] := coefficientY;
equations[eqCounter, 3] := constant;
end;
end;
for eqCounter := 1 to 10000 do
begin
writeln(equations[eqCounter, 1], 'x • ', equations[eqCounter, 2], 'y = ', equations[eqCounter, 3]);
end;
end.