Program Toi2; type time = record day, hour, minute, second : integer end; var t1, t2, t3 : time;
procedure add60(a, b : integer; var c : integer; var carry : boolean); (* a + b must be less than 120 *) begin c := a + b; carry := (c >= 60); c := c mod 60 end;
begin (* データを読む1 -> t1 *)(* データを読む2 -> t2 *) add60(t1.second, t2.second, t3.second, cry); add60(t1.minute, t2.minute + ord(cry), t3.minute, cry); with t3 do begin hour := t1.hour + t2.hour + ord(cry); if hour >= 24 then begin day := 1; hour := hour -24 end else day := 0 end; (* 表示 *) end.