uses
CRT;
type
TDate = record
y, m, d: integer;
end;
const
vesna = [3..5];
function StrToDate(str: string): TDate;
var
t: TDate;
i: integer;
ts: string;
begin
Val(str[1] + str[2], t.d, i);
Val(str[4] + str[5], t.m, i);
val(str[7] + str[8] + str[9] + str[10], t.y, i);
StrToDate := t;
end;
var
year: integer;
f: text;
ts: string;
last, tmp_date: TDate;
begin
clrscr;
assign(f, 'input.txt');
reset(f);
year := maxint;
last.y := 0;
last.d := 0;
last.m := 0;
writeln('Весенние даты: ');
while not eof(f) do
begin
readln(f, ts);
tmp_date := StrToDate(ts);
if tmp_date.m in vesna then
write(ts, ' ');
if tmp_date.y < year then
year := tmp_date.y;
if (tmp_date.y >= last.y) and (tmp_date.m >= last.m) and (tmp_date.d > last.d) then
last := tmp_date;
end;
writeln;
writeLn('Год с наим. номером: ', year);
writeLn('Самая поздняя дата: ', last.d, '.', last.m, '.', last.y);
readln;
close(f);
end.
uses
CRT;
type
TDate = record
y, m, d: integer;
end;
const
vesna = [3..5];
procedure StrToDate(str: string; var t: TDate);
var
i: integer;
begin
Val(str[1] + str[2], t.d, i);
Val(str[4] + str[5], t.m, i);
val(str[7] + str[8] + str[9] + str[10], t.y, i);
end;
var
year: integer;
f: text;
ts: string;
last, tmp_date: TDate;
begin
clrscr;
assign(f, 'input.txt');
reset(f);
year := maxint;
last.y := 0;
last.d := 0;
last.m := 0;
writeln('Весенние даты: ');
while not eof(f) do
begin
readln(f, ts);
StrToDate(ts, tmp_date);
if tmp_date.m in vesna then
write(ts, ' ');
if tmp_date.y < year then
year := tmp_date.y;
if (tmp_date.y >= last.y) and (tmp_date.m >= last.m) and (tmp_date.d > last.d) then
last := tmp_date;
end;
writeln;
writeLn('Год с наим. номером: ', year);
writeLn('Самая поздняя дата: ', last.d, '.', last.m, '.', last.y);
readln;
close(f);
end.
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.