Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fetchHighest(data: people): integer; // returns salesman id
- var
- i: integer;
- t: array[0..1] of integer;
- begin
- t[0] := 0;
- t[1] := 0;
- for i := 1 to length(data) do begin
- if data[i].score > t[1] then begin
- t[0] := i;
- t[1] := data[i].score;
- end;
- end;
- Result := t[0];
- end;
- function fetchLowest(data: people): integer;
- var
- i: integer;
- t: array[0..1] of integer;
- begin
- t[0] := fetchHighest(data);
- t[1] := data[t[0]].score;
- for i := 1 to length(data) do begin
- if data[i].score < t[1] then begin
- t[0] := i;
- t[1] := data[i].score;
- end;
- end; // for
- Result := t[0];
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement