3 then begin A: = A * 60 + S; inc (mode) end;
inc (i)
end;
if mode = 3 then A: = a * 60 + s;
if a <1440 then Stime: = a else DTErr: = true;
end;
Function DayInMonth (m: byte; y: integer): byte;
const DayInM: array [1 .. 12] of byte = (31,29,31,30,31,30,31,31,30,31,30,31);
begin
If M <> 2 then DayInMonth: = DayInM [M]
else if (y mod 4) <> 0 then DayInMonth: = 28
else if (y mod 100) <> 0 then DayInMonth: = 29
else if (y mod 400) <> 0 then DayInMonth: = 28 else DayInMonth: = 29
end;
Function DayDiffer (A, B: dat): Integer;
Var m1, m2, y1, y2: Integer;
Begin
DTErr: = false;
y1: = A.year;
y2: = B.year;
if a.month <= 2 then begin m1: = a.month +12; dec (y1) end else m1: = a.month;
if b.month <= 2 then begin m2: = b.month +12; dec (y2) end else m2: = b.month;
DayDiffer: = - (A.day +30 * m1 + trunc (0.6 * (m1 +1)) +365 * y1 + (y1 div 4) - (y1 div 100) + (y1 div 400)) +
(B.day +30 * m2 + trunc (0.6 * (m2 +1)) +365 * y2 + (y2 div 4) - (y2 div 100) + (y2 div 400));
End;
Procedure DTInput (var d: dat);
var st: string; y: byte;
const empty = '';
begin
y: = wherey;
repeat
GotoXY (1, y);
Write ('"в ...', empty);
GotoXY (10, y);
ReadLn (St);
SDate (st, d);
Until not DTErr;
GotoXY (10, y);
writeln (d.day, '.', d.month, '.', d.year, ' ', Rweek [Dweek (d)]);
repeat
gotoxy (1, y +1);
write (', ॠ¬ п ...', empty);
gotoxy (11, y +1);
readln (st);
d.time: = stime (st);
until not DTErr;
gotoxy (11, y +1);
writeln (stime (st) div 60, ':', stime (st) mod 60);
end;
procedure writedat (b: dat);
begin
write (b.time div 60, ':', b.time mod 60, ' ', B.day,'. ', B.month,'. ', B.year,' ', Rweek [b.dweek]);
end;
procedure newdat (a: dat; delay: word; var b: dat);
var c: word;
begin
B: = A;
B.time: = (a.time + (delay mod 1440)) mod 1440;
delay: = (delay div 1440) + ((a.time + (delay mod 1440)) div 1440);
while delay + b.day> DayInMonth (b.month, b.year) do begin
delay: = delay-1-DayInMonth (b.month, b.year) + b.day;
b.day: = 1;
b.month: = (b.month mod 12) +1;
if b.month = 1 then inc (b.year);
end;
b.day: = delay + b.day;
end;
begin
end.
[1] Поточний місто - є пункт призначення.