michael 25 лет назад
Родитель
Сommit
65b64e27c1
6 измененных файлов с 142 добавлено и 0 удалено
  1. 17 0
      docs/refex/ex103.pp
  2. 17 0
      docs/refex/ex104.pp
  3. 27 0
      docs/refex/ex105.pp
  4. 27 0
      docs/refex/ex106.pp
  5. 27 0
      docs/refex/ex107.pp
  6. 27 0
      docs/refex/ex108.pp

+ 17 - 0
docs/refex/ex103.pp

@@ -0,0 +1,17 @@
+Program Example103;
+
+{ Program to demonstrate the FillByte function. }
+
+Var S : String[10];
+    I : Byte;
+
+begin
+  For i:=10 downto 0 do
+    begin
+    { Fill S with i bytes }
+    FillChar (S,SizeOf(S),32);
+    { Set Length }
+    SetLength(S,I);
+    Writeln (s,'*');
+    end;
+end.

+ 17 - 0
docs/refex/ex104.pp

@@ -0,0 +1,17 @@
+Program Example104;
+
+{ Program to demonstrate the FillDWord function. }
+
+Const 
+  ArraySize = 1000;
+
+Var
+  S : Array [1..ArraySize] of DWord;
+  I : longint;
+  
+begin
+  FillDWord(S,ArraySize,0);
+  For I:=1 to ArraySize do
+    If S[i]<>0 then 
+      Writeln('Position ',i,' not zeroed out');
+end.

+ 27 - 0
docs/refex/ex105.pp

@@ -0,0 +1,27 @@
+Program Example105;
+
+{ Program to demonstrate the IndexByte function. }
+
+Const
+  ArraySize = 256;
+  MaxValue = 256;
+  
+Var
+  Buffer : Array[1..ArraySize] of Byte; 
+  I,J : longint;
+  K : Byte;
+  
+begin
+  Randomize;
+  For I:=1 To ArraySize do 
+    Buffer[I]:=Random(MaxValue);
+  For I:=1 to 10 do
+    begin
+    K:=Random(MaxValue);
+    J:=IndexByte(Buffer,ArraySize,K);
+    if J=-1 then
+      Writeln('Value ',K,' was not found in buffer.')
+    else
+      Writeln('Found ',K,' at position ',J,' in buffer');
+    end;  
+end.

+ 27 - 0
docs/refex/ex106.pp

@@ -0,0 +1,27 @@
+Program Example106;
+
+{ Program to demonstrate the IndexDWord function. }
+
+Const
+  ArraySize = 1000;
+  MaxValue = 1000;
+  
+Var
+  Buffer : Array[1..ArraySize] of DWord; 
+  I,J : longint;
+  K : DWord;
+  
+begin
+  Randomize;
+  For I:=1 To ArraySize do 
+    Buffer[I]:=Random(MaxValue);
+  For I:=1 to 10 do
+    begin
+    K:=Random(MaxValue);
+    J:=IndexDWord(Buffer,ArraySize,K);
+    if J=-1 then
+      Writeln('Value ',K,' was not found in buffer.')
+    else
+      Writeln('Found ',K,' at position ',J,' in buffer');
+    end;  
+end.

+ 27 - 0
docs/refex/ex107.pp

@@ -0,0 +1,27 @@
+Program Example107;
+
+{ Program to demonstrate the IndexWord function. }
+
+Const
+  ArraySize = 1000;
+  MaxValue = 1000;
+  
+Var
+  Buffer : Array[1..ArraySize] of Word; 
+  I,J : longint;
+  K : Word;
+  
+begin
+  Randomize;
+  For I:=1 To ArraySize do 
+    Buffer[I]:=Random(MaxValue);
+  For I:=1 to 10 do
+    begin
+    K:=Random(MaxValue);
+    J:=IndexWord(Buffer,ArraySize,K);
+    if J=-1 then
+      Writeln('Value ',K,' was not found in buffer.')
+    else
+      Writeln('Found ',K,' at position ',J,' in buffer');
+    end;  
+end.

+ 27 - 0
docs/refex/ex108.pp

@@ -0,0 +1,27 @@
+Program Example108;
+
+{ Program to demonstrate the IndexChar function. }
+
+Const
+  ArraySize = 1000;
+  MaxValue = 26;
+  
+Var
+  Buffer : Array[1..ArraySize] of Char; 
+  I,J : longint;
+  K : Char;
+  
+begin
+  Randomize;
+  For I:=1 To ArraySize do 
+    Buffer[I]:=chr(Ord('A')+Random(MaxValue));
+  For I:=1 to 10 do
+    begin
+    K:=chr(Ord('A')+Random(MaxValue));
+    J:=IndexChar(Buffer,ArraySize,K);
+    if J=-1 then
+      Writeln('Value ',K,' was not found in buffer.')
+    else
+      Writeln('Found ',K,' at position ',J,' in buffer');
+    end;  
+end.