Advertisement
Guest User

tp 1 ej 1 e MAYOR VALOR

a guest
Aug 15th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.94 KB | None | 0 0
  1. program agregarvalor;
  2.  
  3. {}
  4. uses crt;
  5. type archent= file of integer;
  6.  
  7. procedure cargararchivo(var ent:archent);
  8. var
  9.     dato,cont: integer;
  10.  
  11. begin
  12.     for cont:=1 to 3 do
  13.     begin  
  14.         writeln('ingrese un valor');
  15.         readln(dato);
  16.         write(ent, dato);
  17.         clrscr;
  18.     end;
  19.     seek(ent, 0);
  20.     for cont:=1 to 3 do
  21.     begin
  22.         writeln('el dato que ingresaste en ', cont, ' es: ');
  23.         read(ent, dato);
  24.         writeln(dato);
  25.     end;
  26. end;
  27.  
  28. function mayorvalor(var ent:archent): integer;
  29. var
  30.     datos,mayor:integer;
  31. begin
  32.     seek(ent, 0);
  33.     read(ent,mayor);
  34.     while not eof(ent) do
  35.     begin
  36.         read(ent,datos);
  37.         if mayor<=datos then
  38.             mayor:=datos;
  39.     end;
  40.     mayorvalor:=mayor;
  41. end;
  42.  
  43. var
  44.     ent:archent;
  45. begin
  46.     assign(ent,'c:\arielemiliomartino9898');
  47.     rewrite(ent);
  48.     cargararchivo(ent);
  49.     writeln(mayorvalor(ent));
  50.     close(ent);
  51. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement