Помогите, пожалуйста, разобраться с данной проблемой.
Надеюсь на понимание.
С уважением,
Юрий.
program rec;
uses crt;
type
TRec = record
name : string [31];
bornyear : integer;
bornmonth : integer;
bornday : integer;
adress : string [250];
end;
TBase = array [1..100] of TRec;
TFile = file of TBase;
procedure ShowInfo (var b : TBase; var f : TFile; x : integer; k : integer);
var
i : byte;
begin
read(f, b);
writeln('Infromation about mans : ');
for i := 1 to k do
with b[i] do begin
if bornyear > x then begin
writeln('Name : ' , name);
writeln('Born day: ' , bornday , '; Born month: ' , bornmonth , 'Born year: ' , bornyear);
writeln('Adress: ' , adress);
writeln;
end;
end;
end;
procedure Input(var b : TBase; var f : TFile; var k : integer);
var
i : byte;
begin
writeln('Vvod bazy dannyx. ');writeln('');
for i := 1 to k do
with b[i] do begin
writeln('Chelovek N ',i);
write('Name : '); readln(name);
write('Born day: '); readln(bornday); write('Born month: '); readln(bornmonth); write('Born year: '); readln(bornyear);
write('Adress: '); readln(adress);
writeln;
end;
write(f, b);
end;
procedure Print(var b : TBase; var f : TFile; var k : integer);
var
i : byte;
begin
read(f, b);
writeln('Infromation about mans : ');
for i := 1 to k do
with b[i] do begin
writeln('Name : ' , name);
writeln('Born day: ' , bornday , '; Born month: ' , bornmonth , 'Born year: ' , bornyear);
writeln('Adress: ' , adress);
writeln;
end;
end;
var
base : TBase;
baseFile : TFile;
birthYr : integer;
temp : integer;
k : integer;
begin
CLRSCR;
temp := -1;
assign(baseFile, 'c:\students.db');
while temp <> 0 do
begin
CLRSCR;
write('1 - create database; 2 - mans which born after X year; 3 - prints database; 0 - exit ... ');
readln(temp);
if temp = 1 then
begin
rewrite(baseFile);
Write('Enter count fo rows for file: '); Readln(k);
Input(base, baseFile, k);
writeLn('Press any key ...'); ReadKey;
close(baseFile);
end;
if temp = 2 then
begin
reset(baseFile);
write('Enter start birthyear: ');
readln(birthYr);
ShowInfo(base, baseFile, birthYr, k);
close(baseFile);
end;
if temp = 3 then
begin
reset(baseFile);
Print(base, baseFile, k);
close(baseFile);
end;
end;
writeln('Press any button for exit ...');
ReadKey
end.