Ahoj, zkouším sestavit program na testování kombinací číselných kodu na jízdenkách, jenže mám asi někde blbě rozsah, hází mi to chybu 201, nevidíte to někdo? Děkuji za jakoukoli užitečnou nápovědu.
Program jizdenky;
uses crt;
var Krabicka:array[1..100000] of integer;
x1,x2,x3,x4,i,j,k,Pocet_v_poli,pocet:integer;
xm:0..9000000;
{ VYNULOVANI KRABICKY }
begin
begin
for i:=1 to 1000 do
Krabicka[i]:=0;
end;
{ VYGENEROVANI CISEL }
repeat
randomize;
x1:=random(9)+1;
//writeln('prvni cislo: ',x1); //vypise prvni cislo
repeat
x2:=random(9)+1;
until x1 <> x2;
//writeln('druhe cislo: ',x2); //vypise druhe cislo
repeat
x3:=random(9)+1;
until ((x1 <> x3) and (x2 <> x3));
//writeln('treti cislo: ',x3); //vypise treti cislo
repeat
x4:=random(9)+1;
until ((x1 <> x3) and (x2 <> x3) and (x1 <> x4) and (x2 <> x4) and (x3 <> x4));
//writeln('ctvrte cislo: ',x4); //vypise ctvrte cislo
// SERAZENI CISEL
begin
pocet:=pocet+1;
if ((x1<x2) and (x2<x3) and (x3<x4)) then
begin
xm:=1000*x1+100*x2+10*x3+x4;
writeln('kombinace: ',xm)
end
else if ((x1<x3) and (x3<x2) and(x2<x4)) then
begin
xm:=1000*x1+100*x3+10*x2+x4;
writeln('kombinace: ',xm)
end
else if ((x1<x4) and (x4<x2) and(x2<x3)) then
begin
xm:=1000*x1+100*x4+10*x2+x3;
writeln('kombinace: ',xm)
end
else if ((x1<x4) and (x4<x3) and(x3<x2)) then
begin
xm:=1000*x1+100*x4+10*x3+x2;
writeln('kombinace: ',xm)
end
else if ((x1<x2) and (x2<x4) and(x4<x3)) then
begin
xm:=1000*x1+100*x2+10*x4+x3;
writeln('kombinace: ',xm)
end
else if ((x2<x1) and (x1<x3) and (x3<x4)) then
begin
xm:=1000*x2+100*x1+10*x3+x4;
writeln('kombinace: ',xm)
end
else if ((x2<x3) and (x3<x1) and (x1<x4)) then
begin
xm:=1000*x2+100*x3+10*x1+x4;
writeln('kombinace: ',xm)
end
else if ((x2<x4) and (x4<x1) and (x1<x3)) then
begin
xm:=1000*x2+100*x4+10*x1+x3;
writeln('kombinace: ',xm)
end
else if ((x2<x4) and (x4<x3) and (x3<x1)) then
begin
xm:=1000*x2+100*x4+10*x3+x1;
writeln('kombinace: ',xm)
end
else if ((x2<x1) and (x1<x4) and (x4<x3)) then
begin
xm:=1000*x2+100*x1+10*x4+x3;
writeln('kombinace: ',xm)
end
else if ((x2<x3) and (x3<x4) and (x4<x1)) then
begin
xm:=1000*x2+100*x3+10*x4+x1;
writeln('kombinace: ',xm)
end
else if ((x3<x1) and (x1<x2) and (x2<x4)) then
begin
xm:=1000*x3+100*x1+10*x2+x4;
writeln('kombinace: ',xm)
end
else if ((x3<x4) and (x4<x1) and (x1<x2)) then
begin
xm:=1000*x3+100*x4+10*x1+x2;
writeln('kombinace: ',xm)
end
else if ((x3<x4) and (x4<x2) and (x2<x1)) then
begin
xm:=1000*x3+100*x4+10*x2+x1;
writeln('kombinace: ',xm)
end
else if ((x3<x1) and (x1<x4) and (x4<x2)) then
begin
xm:=1000*x3+100*x1+10*x4+x2;
writeln('kombinace: ',xm)
end
else if ((x3<x2) and(x2<x4) and (x4<x1)) then
begin
xm:=1000*x3+100*x2+10*x4+x1;
writeln('kombinace: ',xm)
end
else
end;
// PRIRAZENI CISEL DO KRABICKY
begin
if Krabicka[xm]=0 then
begin
Krabicka[xm]:=1;
Pocet_v_poli:=Pocet_v_poli+1;
writeln('Zrovna mame ',Pocet_v_poli,' listku.');
end;
end;
//until keypressed;
until Pocet_v_poli = 84;
readln;
writeln('Mame ',Pocet_v_poli,' listku.');
writeln('Pocet nakoupenych listku celkem: ',pocet);
readln;
end.