результат: (Показать/Скрыть)
What|Not| Is
Crt | *
File| *
Iterations = 100000
Time = 1001
What|Not| Is
Crt | ....... *
File| *
Iterations = 100000
Time = 3762
What|Not| Is
Crt | *
File| ........*
Iterations = 100000000
Time = 551
What|Not| Is
Crt | ...... *
File| ....... *
Iterations = 100000000
Time = 625
почему? (Показать/Скрыть)
{$define crt}
{$define file}
uses
{$ifdef crt}
Crt,
{$endif}
Dos;
type
TR = record
h,m,s,ss:word;
end;
function ResTime(const s,e: TR): longint;
begin
ResTime := (e.ss-s.ss)+100*((e.s-s.s)+60*((e.m-s.m)+60*(e.h-s.h)));
end;
var
s, e: TR;
L, H, i: Longint;
fr, f: text;
begin
L := 1;
{$ifdef file}
H := 100*1000*1000;
assign(f,'f');
rewrite(f);
{$else}
H := 100*1000;
f := output;
{$endif}
with s do gettime(h,m,s,ss);
for i := L to H do
write(f,'*'); //при Сrt и выводе на экран при такой
//записи на экран выводятся пробелы,
//а при такой write(output,'*'); все нормально
with e do gettime(h,m,s,ss);
{$ifdef file}
close(f);
{$endif}
assign(fr,'Result.txt');
{$I-}
append(fr);
{$I+}
if ioresult <> 0 then
rewrite(fr);
writeln(fr,'What|Not| Is');
write(fr,'Crt |');
{$ifdef crt}
write(fr,' ');
{$endif}
writeln(fr,' *');
write(fr,'File|');
{$ifdef file}
write(fr,' ');
{$endif}
writeln(fr,' *');
writeln(fr,'Iterations = ',H-L+1);
writeln(fr,'Time = ',ResTime(s,e));
writeln(fr);
close(fr);
end.