~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to fpcdocs/refex/ex105.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Program Example105;
 
2
 
 
3
{ Program to demonstrate the IndexByte function. }
 
4
 
 
5
Const
 
6
  ArraySize = 256;
 
7
  MaxValue = 256;
 
8
 
 
9
Var
 
10
  Buffer : Array[1..ArraySize] of Byte;
 
11
  I,J : longint;
 
12
  K : Byte;
 
13
 
 
14
begin
 
15
  Randomize;
 
16
  For I:=1 To ArraySize do
 
17
    Buffer[I]:=Random(MaxValue);
 
18
  For I:=1 to 10 do
 
19
    begin
 
20
    K:=Random(MaxValue);
 
21
    J:=IndexByte(Buffer,ArraySize,K);
 
22
    if J=-1 then
 
23
      Writeln('Value ',K,' was not found in buffer.')
 
24
    else
 
25
      Writeln('Found ',K,' at position ',J,' in buffer');
 
26
    end;
 
27
end.