Guest User

Untitled

a guest
Apr 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.78 KB | None | 0 0
  1. program a;
  2. type Ora=0..23;
  3. Grade=-40..+40;
  4. Temperatura=array[Ora] of Grade;
  5.  
  6.  
  7. procedure pro(temp:Temperatura);
  8. var
  9. min,max:Grade;
  10. i:Ora;
  11. f:Text;
  12. begin
  13. //1
  14. min:=high(Grade); max:=low(Grade);
  15. for i:=low(Ora) to high(Ora) do
  16. begin
  17.   if temp[i]>max then max:=temp[i];
  18.   if temp[i]<min then min:=temp[i];
  19. end;
  20. writeln('minim=',min,' maxim=',max);
  21. //2
  22. for i:=low(Ora) to high(Ora) do
  23.   if (temp[i]=max) then writeln('la ora ',i,' s-a inregistrat maximul ',max);
  24. //3
  25. assign(f,'fisier.txt');
  26. rewrite(f);
  27. for i:=low(Ora) to high(Ora) do
  28.   if (temp[i]=min) then writeln(f,'la ora ',i,' s-a inregistrat minimul ',min);
  29. close(f);
  30. end;
  31.  
  32.  
  33. var temp:Temperatura;
  34. begin
  35. temp[0]:=4;
  36. temp[1]:=-6;
  37. temp[5]:=4;
  38. temp[8]:=4;
  39. temp[10]:=-6;
  40. temp[12]:=-6;
  41. temp[11]:=3;
  42. pro(temp);
  43. end.
Add Comment
Please, Sign In to add comment