PROG17.PAS  ·  PAS  ·  768 B  ·  1985-08-25  ·  from IBM-PC-User-Group-Software-Library_Disk-101-Turbo-Lessons
PROGRAM PROG17;
{$U+    Copyright (C), 1985 by Lyle Faurot.  All rights reserved.

    New Topics:  Include files
                 Timing function

}

VAR
  A, B,
  Start_Time,
  Stop_Time,
  Elapsed_Time : Real;

  I, J, K      : Integer;

{$I Time.Inc    Get system time in seconds }

BEGIN
  REPEAT
    WriteLn('Enter number of repetitions: ');
    Read(K);

    Start_Time := Time;
    FOR I := 1 to K DO
      A := Time;
    Stop_Time := Time;

    Elapsed_Time := Stop_Time - Start_Time;
    Write(' Repetitions took ', Elapsed_Time:-6:4, ' Seconds,');
    WriteLn(' One Repetition took ', Elapsed_Time / K:-6:4,' Seconds');
    WriteLn;
  UNTIL K=9;
END.