home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pas_nl / 06 / sequent.pas < prev   
Pascal/Delphi Source File  |  1991-03-17  |  672b  |  23 lines

  1. Function Sequential(look:integer):integer;{Sequential search}
  2. {Look is the id you are looking for}
  3. var
  4.     temp:integer;                        {Temporary number}
  5.     q:boolean;                           {Quit loop}
  6.     f:integer;                           {For loops}
  7. Begin
  8.     sequential:=-1;                      {Temporary set to not found}
  9.     q:=false;                            {Set quit to no}
  10.  
  11.     for f:=1 to count do begin
  12.         if a[f].id=look then begin
  13.            sequential:=a[f].inv;
  14.            q:=true;
  15.         end
  16.         else if a[f].id>look then begin
  17.            exit;
  18.         end;
  19.         if q=true then exit
  20.     end;
  21.  
  22. End;
  23.