Привет всем. Не могу добить задачу. Чета в ней не работает: толи запись в файл, толи вывод данных из файла.
Вот:
Program address_book;
uses crt;
type
book=record
fam:string[25];
name:string[15];
otch:string[25];
street:string[30];
n_h, n_at,n_ph:integer;
end;
var
s:array[1..100] of book;
f:file of book;
i,n,a:integer;
b:book;
begin
repeat
clrscr;
writeln('Menu');
writeln;
writeln('1 - Vvesti dannie v adresnui-o knigy');
writeln('2 - Prosmotret adresnyi-o knigu');
writeln('3 - Exit');
readln(a);
case a of
1: begin
clrscr;
assign(f,'file_');
rewrite(f);
write('Vvedite kol-vo zapisei: '); readln(n);
for i:=1 to n do
with s[i] do
begin
writeln;
write(i:2,' ');
write('Familiya: '); readln(fam);
write(' Name: '); readln(name);
write(' Otchestvo: '); readln(otch);
write(' Nazvanie ylici: '); readln(street);
write(' N doma: '); readln(n_h);
write(' N kvartiri: '); readln(n_at);
write(' N telephona: '); readln(n_ph);
write(f,s[i]);
end;
close(f);
end;
2: begin
assign(f,'file_');
reset(f);
while not eof(f) do
read(f,s[i]);
with s[i] do
begin
writeln(fam);
writeln(name);
writeln(otch);
writeln(street);
writeln(n_h);
writeln(n_at);
writeln(n_ph);
end;
end;
end;
until a=3;
repeat until keypressed;
end.