uses crt;
type time=record
h:0..23;
m,s:0..59;
end;
procedure Interval(var d:time;t1,t2:time);
var p:0..59;
begin
if t2.s>=t1.s then
begin
d.s:=t2.s-t1.s;
p:=0;
end
else
begin
d.s:=60+t2.s-t1.s;
p:=1;
end;
if t2.m-p>=t1.m then
begin
d.m:=t2.m-p-t1.m;
p:=0;
end
else
begin
d.m:=60+t2.m-p-t1.m;
p:=1;
end;
if t2.h-p>=t1.h then d.h:=t2.h-p-t1.h
else d.h:=24+t2.h-p-t1.h;
write('Прошло времени=',d.h,'ч. ',d.m,'мин. ',d.s,'сек');
end;
var n,k,r:time;
f:boolean;
begin
clrscr;
repeat
f:=true;
writeln('Введите первое время, часы минуты секунды:');
readln(n.h,n.m,n.s);
if not(n.h in [0..23]) or not(n.m in [0..59]) or not(n.s in [0..59])then
begin
f:=false;
writeln('Время введено неверно, повторите ввод');
end;
until f;
repeat
f:=true;
writeln('Введите второе время, не меньше первого и не больше 23:59:59');
readln(k.h,k.m,k.s);
if not(k.h in [0..23]) or not(k.m in [0..59]) or not(k.s in [0..59])
or((k.h<n.h)or((k.h=n.h)and(k.m<n.m))or((k.h=n.h)and(k.m=n.m)and(k.s>n.s)))
then
begin
f:=false;
writeln('Время введено неверно, повторите ввод');
end;
until f;
Interval(r,n,k);
readln
end.