Advertisement
volkovich_maksim

t_16_30_B_v1_volkovich

Nov 29th, 2015
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.53 KB | None | 0 0
  1. {Волкович Максим (volkovcih.maksim.s@gmail.com), 112гр., v1.0,
  2. описать рекурсивную функцию, которая находит максимальный элемент списка L}
  3. type list=^chain;
  4.      chain=record elem:real; next:list end;
  5. function max(L:list):real;
  6.     function max2(a,b:real):real;
  7.          begin
  8.                if a>=b then max:=a else max2:=b;
  9.          end;
  10.     begin
  11.          if L^.next<>nil then max:=max2(L^elem,max(L^.next))
  12.          else max:=L^.elem;  
  13.     end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement