Добавлен: 23.11.2023
Просмотров: 95
Скачиваний: 6
ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
i,vid:byte;
end_menu:boolean;
name:stfio;
count,x,y:integer;
f:text;
procedure Create_Book_Phone;
begin
writeln ('Sozdanie ot4etov v telefonnoi knige: ');
write ('Vvedite 4islo ot4eta : ');
readln (count);
for i:=1 to count do
begin
assign (f,'c:\baz.dat');
rewrite (f);
{append (f);}
write ('vvedite familiy: ');
readln (baza[i].fio);
write (f,baza[i].fio);
write ('vvedite telefonnyi nomer: ');
readln (baza[i].phone);
write (f,baza[i].phone);
{close(f);}
{reset (f);
read (f);}
close (f);
end;
writeln ('Sozdanie spravo4nika zakon4eno');
writeln ('There are ',count,' records in the phonebook');
end;
procedure output_all_record;
begin
{assign (f,'c:\baz.dat');
reset (f);}
{while not eof(f) do}
writeln ('Dannie telefonnoi knigi');
writeln (' F.I.O. telefonnyi nomer');
assign (f,'c:\baz.dat');
reset (f);
begin
read (f,baza[i].fio,baza[i].phone);
write ({baza[i].fio:8,baza[i].phone:14}count);
end;
for i:=1 to count do
writeln ( baza[i].fio:8, baza[i].phone:14);
writeln;
close (f);
end;
procedure update_record;
begin
assign (f,'c:\baz.dat');
append (f);
write ('enter F.I.O.');
readln (name);
for i:=1 to count do
if name=baza[i].fio then
begin
write ('VVedite telefonnyi nomer');
readln (baza[i].phone) ;
end;
close (f);
end;
procedure find_fio;
begin
write ('enter F.I.O: ');
readln (name);
for i:=1 to count do begin
if name=baza[i].fio then
writeln ('surname: ',baza[i].fio,'; phone: ',baza[i].phone)
else {writeln ('*****net v telefonnoi knige******');}
end;
assign (f,'c:\baz.dat');
reset (f);
read (f,baza[i].fio,baza[i].phone);
close (f);
end;
begin
assign (f,'c:\baz.dat');
clrscr;
end_menu:=false;
repeat
x:=20;y:=5;
textbackground(red);
y:=y+1; gotoxy(x,y); write(' ***Phone book*** ');
y:=y+1; gotoxy(x,y); write('ЙННННННННННННННННННННННННННННННННННННН»');
y:=y+1; gotoxy(x,y); write('є VYBERI PUNKT MENU є');
y:=y+1; gotoxy(x,y); write('є 1. Sozdanie telefonnoi knigi є');
y:=y+1; gotoxy(x,y); write('є 2. Obzor telefonnogo spravo4nika є');
y:=y+1; gotoxy(x,y); write('є 3. Redaktirovanie spravo4nika є');
y:=y+1; gotoxy(x,y); write('є 4. Poisk abonenta є');
y:=y+1; gotoxy(x,y); write('є 0. Vyhod є');
y:=y+1; gotoxy(x,y); write('ИНННННННННННННННННННННННННННННННННННННј');
writeln;
write(' PUNKT MENU: ');;
textbackground(red);
readln (vid);
case vid of
1: create_book_phone;
2: output_all_record;
3: update_record;
4: find_fio;
0: end_menu:=true
end;
writeln ('press ENTER to continue');
readln;
clrscr;
until end_menu;
repeat until keypressed;
end.
end_menu:boolean;
name:stfio;
count,x,y:integer;
f:text;
procedure Create_Book_Phone;
begin
writeln ('Sozdanie ot4etov v telefonnoi knige: ');
write ('Vvedite 4islo ot4eta : ');
readln (count);
for i:=1 to count do
begin
assign (f,'c:\baz.dat');
rewrite (f);
{append (f);}
write ('vvedite familiy: ');
readln (baza[i].fio);
write (f,baza[i].fio);
write ('vvedite telefonnyi nomer: ');
readln (baza[i].phone);
write (f,baza[i].phone);
{close(f);}
{reset (f);
read (f);}
close (f);
end;
writeln ('Sozdanie spravo4nika zakon4eno');
writeln ('There are ',count,' records in the phonebook');
end;
procedure output_all_record;
begin
{assign (f,'c:\baz.dat');
reset (f);}
{while not eof(f) do}
writeln ('Dannie telefonnoi knigi');
writeln (' F.I.O. telefonnyi nomer');
assign (f,'c:\baz.dat');
reset (f);
begin
read (f,baza[i].fio,baza[i].phone);
write ({baza[i].fio:8,baza[i].phone:14}count);
end;
for i:=1 to count do
writeln ( baza[i].fio:8, baza[i].phone:14);
writeln;
close (f);
end;
procedure update_record;
begin
assign (f,'c:\baz.dat');
append (f);
write ('enter F.I.O.');
readln (name);
for i:=1 to count do
if name=baza[i].fio then
begin
write ('VVedite telefonnyi nomer');
readln (baza[i].phone) ;
end;
close (f);
end;
procedure find_fio;
begin
write ('enter F.I.O: ');
readln (name);
for i:=1 to count do begin
if name=baza[i].fio then
writeln ('surname: ',baza[i].fio,'; phone: ',baza[i].phone)
else {writeln ('*****net v telefonnoi knige******');}
end;
assign (f,'c:\baz.dat');
reset (f);
read (f,baza[i].fio,baza[i].phone);
close (f);
end;
begin
assign (f,'c:\baz.dat');
clrscr;
end_menu:=false;
repeat
x:=20;y:=5;
textbackground(red);
y:=y+1; gotoxy(x,y); write(' ***Phone book*** ');
y:=y+1; gotoxy(x,y); write('ЙННННННННННННННННННННННННННННННННННННН»');
y:=y+1; gotoxy(x,y); write('є VYBERI PUNKT MENU є');
y:=y+1; gotoxy(x,y); write('є 1. Sozdanie telefonnoi knigi є');
y:=y+1; gotoxy(x,y); write('є 2. Obzor telefonnogo spravo4nika є');
y:=y+1; gotoxy(x,y); write('є 3. Redaktirovanie spravo4nika є');
y:=y+1; gotoxy(x,y); write('є 4. Poisk abonenta є');
y:=y+1; gotoxy(x,y); write('є 0. Vyhod є');
y:=y+1; gotoxy(x,y); write('ИНННННННННННННННННННННННННННННННННННННј');
writeln;
write(' PUNKT MENU: ');;
textbackground(red);
readln (vid);
case vid of
1: create_book_phone;
2: output_all_record;
3: update_record;
4: find_fio;
0: end_menu:=true
end;
writeln ('press ENTER to continue');
readln;
clrscr;
until end_menu;
repeat until keypressed;
end.