Guest User

Untitled

a guest
Apr 20th, 2018
99
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. //1
  7. procedure pro(temp:Temperatura);
  8. var
  9. min,max:Grade;
  10. i:Ora;
  11. f:Text;
  12. begin
  13. min:=high(Grade); max:=low(Grade);
  14. for i:=low(Ora) to high(Ora) do
  15. begin
  16.   if temp[i]>max then max:=temp[i];
  17.   if temp[i]<min then min:=temp[i];
  18. end;
  19. writeln('minim=',min,' maxim=',max);
  20. //2
  21. for i:=low(Ora) to high(Ora) do
  22.   if (temp[i]=max) then writeln('la ora ',i,' s-a inregistrat maximul ',max);
  23. //3
  24. assign(f,'fisier.txt');
  25. rewrite(f);
  26. for i:=low(Ora) to high(Ora) do
  27.   if (temp[i]=min) then writeln(f,'la ora ',i,' s-a inregistrat minimul ',min);
  28. close(f);
  29. end;
  30.  
  31.  
  32. var temp:Temperatura;
  33. begin
  34. temp[0]:=4;
  35. temp[1]:=-6;
  36. temp[5]:=4;
  37. temp[8]:=4;
  38. temp[10]:=-6;
  39. temp[12]:=-6;
  40. temp[11]:=3;
  41. pro(temp);
  42. end.
Add Comment
Please, Sign In to add comment