МОДУЛЬ
unit ss;
interface
type
peop=record
fam:string[15];
nam:string[15];
rod:string[10];
city:string[15];
year:1900..2007;
prof:string[15];
end;
t=file of peop;
procedure create(var f1:t);
procedure obr(var f1:t);
procedure pech(var f1:t);
implementation
procedure create;
var
n,i:byte;
s:peop;
begin
reset(f1);
write('vvedite kol-vo= ');
readln(n);
for i:=1 to n do
begin
write('familiy= ');readln(s.fam);
write('name= ');readln(s.nam);
write('rod= ');readln(s.rod);
write('city= ');readln(s.city);
write('year= ');readln(s.year);
write('Profession= ');readln(s.prof);
write(f1,s);
end;
close(f1);
end;
procedure pech;
var
i,n:byte;
s:peop;
begin
reset(f1);
for i:=1 to filesize(f1) do
begin
read(f1,s);
with s do
write(fam,' ',nam,' ',rod,' ',city,' ',year,' ',prof,' ');
writeln;
end;
end;
procedure obr;
var
i:byte;
s:peop;
srv:integer;
begin
reset(f1);
srv:=0;
for i:=1 to filesize(f1) do
begin
read(f1,s);
srv:=srv+(2008-s.year);
end;
close(f1);
srv:=srv div i;
reset(f1);
writeln('srednij vozrast = ',srv);
writeln('rodstvenniki, vozrast kotorih menshe srednego:');
writeln;
for i:=1 to filesize(f1) do
begin
read(f1,s);
if (2008-s.year)< srv then
begin
with s do
begin
writeln(fam,' ',nam,' ',rod,' ',city,' ',year,' ',prof);
writeln('-------------------------------------------------');
end;
end;
end;
close(f1);
end;
end.
ОСНОВНАЯ ПРОГРАММА
program kk;
uses crt,SS;
var
i:byte;
f1:t;
begin
clrscr;
assign(f1,'data.dbf');
{$I-}
reset(f1);
{$I+}
if Ioresult<>0 then
begin
rewrite(f1);
create(f1);
end;
{create(f1);}
pech(f1);
obr(f1);
readln;
end.