Obarvený kód souboru sazka2.pas
uses crt;
type pol = record
rok,tyden : integer;
tah : array[1..2,1..7] of byte;
end;
var data : pol;
f : file;
x,q,w,y : integer;
a : boolean;
fn : text;
sp : array[1..49] of real;
m : real;
c : byte;
t : array[1..49] of byte;
begin
clrscr;
assign(f,'streda.dat');
reset(f,1);
assign(fn,'streda.vys');
rewrite(fn);
for y:=1 to 49 do sp[y]:=1;
for x:=1 to filesize(f) div sizeof(data) do
begin
blockread(f,data,sizeof(data));
for y:=1 to 49 do
begin
a:=false;
for w:=1 to 7 do
if data.tah[1,w]=y then a:=true;
if a then
begin
write(fn,'1');
write('?');
sp[y]:=sp[y]+1; (* nebo x2 *)
end
else
begin
write(' ');
write(fn,'0');
sp[y]:=sp[y]*0.9;
end;
end;
writeln(fn);
writeln;
end;
for q:=1 to 49 do
t[q]:=0;
for x:=1 to 6 do
begin
m:=0;
c:=0;
for y:=1 to 49 do
if sp[y]>m then
begin
m:=sp[y];
c:=y;
end;
t[c]:=1;
sp[c]:=0;
write(c,'-');
end;
writeln;
for y:=1 to 49 do
begin
if t[y]=1 then
write('?')
else
write(' ');
end;
close(fn);
close(f);
readln;
end.
created by PaJa