Код
uses crt;
type
data = record
day: 1..31;
month: 1..12;
year: 1980..1990;
end;
anketa = record
surname: char;
sex: char;
birth: data;
end;
const n = 2;
label
1,2,3,4,5;
var
d: array[1..n] of data;
a: array[1..n] of anketa;
m: set of 1..12;
i,m1,j: integer;
ch: char;
Mold: integer;
begin
clrscr;
for i:=1 to n do begin
writeln;
writeln;
writeln;
write(' ',i,'.1) ‚ўҐ¤ЁвҐ д ¬Ё«Ёо -> ');
readln(a[i].surname);
1:
write(' ',i,'.2) ‚ўҐ¤ЁвҐ Ї®« -> ');
readln(a[i].sex);
if not a[i].sex in ['†','¦','¬','Њ'] then begin
write(a[i].sex,' нв® зв® Ї®-ў 襬㠯®«? Њ Ё«Ё † ???');
writeln;
goto 1;
end;
writeln(' ',i,'.3) „ в ஦¤ҐЁп : ');
2:
write(' ‚ўҐ¤ЁвҐ ¬Ґбпж -> ');
readln(d[i].month);
if (d[i].month>12)or(d[i].month<1) then begin
write(' ‚ Ј®¤г 12 ¬Ґбп楢, Ґ ',d[i].month,';)');
writeln;
goto 2;
end;
3:
write(' ‚ўҐ¤ЁвҐ ¤Ґм -> ');
readln(d[i].day);
if (d[i].month = 2)and((d[i].day>28)or(d[i].day<1)) then begin
write(' ‚ дҐўа «Ґ ўбҐЈ® 28 ¤Ґ©!');
writeln;
goto 3;
end;
if not (d[i].month = 2)and((d[i].day>31)or(d[i].day<1)) then begin
write(' ‚ н⮬ ¬ҐбпжҐ 31 ¤Ґм!');
writeln;
goto 3;
end;
4:
write(' ‚ўҐ¤ЁвҐ ѓ®¤ -> ');
readln(d[i].year);
if (d[i].year<1950)or(d[i].year>2000) then begin
write(' !!! „®ЇгбвЁ¬л© ўў®¤ Ј®¤ 1950-2000 !!!');
writeln;
goto 4;
end;
clrscr;
end;
writeln;
write('** **');
write('============‚ и Ѓ § „ ле============');
write('~~ ~~');
for i:=1 to n do begin
writeln('----------------------------------|',i,'-п § ЇЁбм|---------------------------------');
writeln(' ” ¬Ё«Ёп: ',a[i].surname);
writeln(' Џ®«: ',a[i].sex);
writeln('„ в ஦¤ҐЁп: ',d[i].day,' / ',d[i].month,' / ', d[i].year);
end;
Mold:=2001;
for i:=1 to n do begin
if (a[i].sex='¬')or(a[i].sex='Њ') then
if d[i].year < Mold then Mold:=d[i].year;
end;
writeln;
writeln('‘ ¬®¬г бв а襬㠬г¦зЁҐ -> ',2003-Mold,' «Ґв');
write('Џ®ЁбЄ Ї® д ¬Ё«Ёп¬. ЃгЄў : ');
readln(ch);
write('‚бҐ д ¬Ё«ЁЁ ',ch,': ');
for i:=1 to n do
if a[i].surname[1] = ch then write(a[i].surname,' ');
writeln;
5:
write('‚ўҐ¤ЁвҐ ¬Ґбпж: ');
readln(m1);
if (m1<1)or(m1>12) then begin
writeln('‚ўҐ¤ЁвҐ Їа ўЁ«мл© ¬Ґбпж!');
goto 5;
end
else
write('‘ЇЁб®Є தЁўиЁебп ў ',m1,'®¬ ¬ҐбпжҐ: ');
for i:=1 to n do
if d[i].month = m1 then write(a[i].surname,' ');
readln;
end.
type
data = record
day: 1..31;
month: 1..12;
year: 1980..1990;
end;
anketa = record
surname: char;
sex: char;
birth: data;
end;
const n = 2;
label
1,2,3,4,5;
var
d: array[1..n] of data;
a: array[1..n] of anketa;
m: set of 1..12;
i,m1,j: integer;
ch: char;
Mold: integer;
begin
clrscr;
for i:=1 to n do begin
writeln;
writeln;
writeln;
write(' ',i,'.1) ‚ўҐ¤ЁвҐ д ¬Ё«Ёо -> ');
readln(a[i].surname);
1:
write(' ',i,'.2) ‚ўҐ¤ЁвҐ Ї®« -> ');
readln(a[i].sex);
if not a[i].sex in ['†','¦','¬','Њ'] then begin
write(a[i].sex,' нв® зв® Ї®-ў 襬㠯®«? Њ Ё«Ё † ???');
writeln;
goto 1;
end;
writeln(' ',i,'.3) „ в ஦¤ҐЁп : ');
2:
write(' ‚ўҐ¤ЁвҐ ¬Ґбпж -> ');
readln(d[i].month);
if (d[i].month>12)or(d[i].month<1) then begin
write(' ‚ Ј®¤г 12 ¬Ґбп楢, Ґ ',d[i].month,';)');
writeln;
goto 2;
end;
3:
write(' ‚ўҐ¤ЁвҐ ¤Ґм -> ');
readln(d[i].day);
if (d[i].month = 2)and((d[i].day>28)or(d[i].day<1)) then begin
write(' ‚ дҐўа «Ґ ўбҐЈ® 28 ¤Ґ©!');
writeln;
goto 3;
end;
if not (d[i].month = 2)and((d[i].day>31)or(d[i].day<1)) then begin
write(' ‚ н⮬ ¬ҐбпжҐ 31 ¤Ґм!');
writeln;
goto 3;
end;
4:
write(' ‚ўҐ¤ЁвҐ ѓ®¤ -> ');
readln(d[i].year);
if (d[i].year<1950)or(d[i].year>2000) then begin
write(' !!! „®ЇгбвЁ¬л© ўў®¤ Ј®¤ 1950-2000 !!!');
writeln;
goto 4;
end;
clrscr;
end;
writeln;
write('** **');
write('============‚ и Ѓ § „ ле============');
write('~~ ~~');
for i:=1 to n do begin
writeln('----------------------------------|',i,'-п § ЇЁбм|---------------------------------');
writeln(' ” ¬Ё«Ёп: ',a[i].surname);
writeln(' Џ®«: ',a[i].sex);
writeln('„ в ஦¤ҐЁп: ',d[i].day,' / ',d[i].month,' / ', d[i].year);
end;
Mold:=2001;
for i:=1 to n do begin
if (a[i].sex='¬')or(a[i].sex='Њ') then
if d[i].year < Mold then Mold:=d[i].year;
end;
writeln;
writeln('‘ ¬®¬г бв а襬㠬г¦зЁҐ -> ',2003-Mold,' «Ґв');
write('Џ®ЁбЄ Ї® д ¬Ё«Ёп¬. ЃгЄў : ');
readln(ch);
write('‚бҐ д ¬Ё«ЁЁ ',ch,': ');
for i:=1 to n do
if a[i].surname[1] = ch then write(a[i].surname,' ');
writeln;
5:
write('‚ўҐ¤ЁвҐ ¬Ґбпж: ');
readln(m1);
if (m1<1)or(m1>12) then begin
writeln('‚ўҐ¤ЁвҐ Їа ўЁ«мл© ¬Ґбпж!');
goto 5;
end
else
write('‘ЇЁб®Є தЁўиЁебп ў ',m1,'®¬ ¬ҐбпжҐ: ');
for i:=1 to n do
if d[i].month = m1 then write(a[i].surname,' ');
readln;
end.