The following two examples are designed for prototype 5.1 and will not work with previous releases of EFLIB. See also the following text files: 1.pas, 2.pas, 3.pas, 4.pas, 5.pas and 6.pas.
Example 1 - Demonstration of the stack data structure uses efDATA; var A : efStack; e : word; begin (* EFLIB HANDLES YOUR INFORMATION! *) (* WORKING WITH A STACK *) A.Create ( SizeOf(e) ); (* Construct a stack *) e := 3; (* Push two elements into the stack *) A.Push ( e ); e := 2; A.Push ( e ); { A --> A } (* Pop elements until stack is emtpy *) while not A.IsEmpty do begin A.Pop ( e ); { e <-- A } Write ( e, ' --> ' ); end; WriteLn ('LIFO'); A.Intercept; (* Destruct the stack *) end.
Example 2 - Demonstration of the number theoretic system uses efSTREAM, efMATH; var Z : efInteger; C : efComplex; begin (* EFLIB HELPS YOU WITH YOUR MATH! *) Z.Create ( 3 ); (* Z = 3 *) C.Create ( 1, 1 ); (* C = (Pi, Pi) *) C.Square ( C ); (* C = C^2 = 2i *) C.Add ( Z );(* C = C + Z = 3+2i *) StdIO.Put (C); (* Output *) WriteLn; Z.Intercept; C.Intercept; (* Destruct all *) end.
Last updated September 16, 1999 by Johan Larsson.
Statistical report.