Rename (temp, 'Phone phone.dat');
writeln;
writeln ('Запис успішно змінена!');
writeln;
write ('Натисніть будь-яку клавішу ...');
ReadKey;
end;
procedure FindSurname;
var Nazv: string [15];
k: integer;
begin
k: = 0;
Assign (PhoneF, 'Phone phone.dat');
Reset (PhoneF);
ClrScr;
writeln ('Пошук запису по Прізвища:');
writeln;
Write ('Введіть Прізвище:');
readln (Nazv);
while not Eof (PhoneF) do
begin
PhoneR.SurnameS: ='';
PhoneR.NameS: ='';
PhoneR.PhoneS: ='';
PhoneR.AddressS: ='';
read (PhoneF, PhoneR);
if PhoneR.SurnameS = Nazv then
begin
writeln;
write (PhoneR.SurnameS);
write ('', PhoneR.NameS);
write ('', PhoneR.PhoneS);
write ('', PhoneR.AddressS);
k: = k +1;
end;
end;
Close (PhoneF);
writeln;
writeln;
writeln ('Пошук завершено, знайдено записів:', k);
writeln;
write ('Натисніть будь-яку клавішу ...');
ReadKey;
end;
procedure FindPhone;
var Nazv: string [15];
k: integer;
begin
k: = 0;
Assign (PhoneF, 'Phone phone.dat');
Reset (PhoneF);
ClrScr;
writeln ('Пошук запису за номером телефону:');
writeln;
Write ('Введіть номер телефону:');
readln (Nazv);
while not Eof (PhoneF) do
begin
PhoneR.SurnameS: ='';
PhoneR.NameS: ='';
PhoneR.PhoneS: ='';
PhoneR.AddressS: ='';
read (PhoneF, PhoneR);
if PhoneR.PhoneS = Nazv then
begin
writeln;
write (PhoneR.SurnameS);
write ('', PhoneR.NameS);
write ('', PhoneR.PhoneS);
write ('', PhoneR.AddressS);
k: = k +1;
end;
end;
Close (PhoneF);
writeln;
writeln;
writeln ('Пошук завершено, знайдено записів:', k);
writeln;
write ('Натисніть будь-яку клавішу ...');
ReadKey;
end;
procedure SortSurname;
var i, j, c: integer;
tr: Phone;
begin
c: = 0;
Assign (PhoneF, 'Phone phone.dat');
Reset (PhoneF);
ClrScr;
writeln ('Сортування за Прізвища:');
writeln;
while not Eof (PhoneF) do begin
inc (c, 1);
read (PhoneF, a [c]);
end;
for i: = 1 to c do
for j: = 1 to c-1 do begin
if a [j]. SurnameS> a [j +1]. SurnameS then begin
tr: = a [j +1];
a [j +1]: = a [j];
a [j]: = tr;
end;
end;
for i: = 1 to c do begin
writeln;
write (a [i]. SurnameS),
write ('', a [i]. NameS);
write ('', a [i]. PhoneS);
write ('', a [i]. AddressS);
end;
Close (PhoneF);
writeln;
writeln;
write ('Натисніть будь-яку клавішу ...');
ReadKey;
end;
procedure SortAddress;
var i, j, c: integer;
tr: Phone;
begin
c: = 0;
Assign (PhoneF, 'Phone phone.dat');
Reset (PhoneF);
ClrScr;
writeln ('Сортування за адресою:');
writeln;
while not Eof (PhoneF) do begin
inc (c, 1);
read (PhoneF, a [c]);
end;
for i: = +1 to c do
for j: = 1 to c-1 do begin
if a [j]. AddressS> a [j +1]. AddressS then begin
tr: = a [j +1];
a [j +1]: = a [j];
a [j]: = tr;
end;
end;
for i: = 1 to c do begin
writeln;
write (a [i]. SurnameS);
write ('', a [i]. NameS);
write ('', a [i]. PhoneS);
write ('', a [i]. AddressS),
end;
Close (PhoneF);
writeln;
writeln;
write ('Натисніть будь-яку клавішу ...');
ReadKey;
end;
procedure SortPhone;
var i, j, c: integer;
tr: Phone;
begin
c: = 0;
Assign (PhoneF, 'Phone phone.dat');
Reset (PhoneF);
ClrScr;
writeln ('Сортування за адресою:');
writeln;
while not Eof (PhoneF) do begin
inc (c, 1);
read (PhoneF, a [c]);
end;
for i: = 1 to c do
for j: = 1 to c-1 do begin
if a [j]. PhoneS> a [j +1]. PhoneS then begin
tr: = a ...