Professional Documents
Culture Documents
Document
Document
{$APPTYPE CONSOLE}
uses
SysUtils;
Type
Ora=0..23;
Grade=-40..+40;
Temperatura=array [Ora] of Grade;
var
t:temperatura;
f:text;
procedure Afisare(t:temperatura);
var o:ora;
begin
for o:=0 to 23 do write(f,'[',o:2,']=',t[o]:2,'':3);
writeln(f);
end;
function Maximum(t:temperatura):Grade;
var o:ora; max:grade;
begin
max:=-40;
for o:=0 to 23 do
if max < t[o] then max:=t[o];
Maximum := max;
end;
function Minimum(t:temperatura):Grade;
var o:ora; min:grade;
begin
min:=+40;
for o:=0 to 23 do
if min > t[o] then min:=t[o];
Minimum := min;
end;
procedure AfisareMod(t:temperatura;md:grade);
var o:ora;
begin
for o:=0 to 23 do
if t[o] = md then write(f,o:3,';');
writeln(f);
end;
begin
//randomize;
assign(f,'d:\nustiu.txt');
rewrite(f);
Masurare(t);
Afisare(t);
writeln(f,'Maximum de ',Maximum(t):3,' grade la orele:');
AfisareMod(t,Maximum(t));
writeln(f,'Minimum de ',Minimum(t):4,' grade la orele:');
AfisareMod(t,Minimum(t));
close(f);
//readln;