Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program LR_16;
- uses crt;
- type
- AbonRec=record
- fam:string[20];
- fio:string[50];
- tel:string[10];
- end;
- TypeFile=file of AbonRec;
- var
- f1:TypeFile;
- s:abonrec;
- f:TypeFile;
- isearch:string;
- nf:string;
- procedure file_cr(nf:string);
- begin
- assign(f,nf);
- rewrite((F));
- with s do begin
- writeln('Окончание ввода - #...');
- repeat
- write('Введите фамилию абонента: ');
- readln(Fam);
- if fam<>'#' then begin
- write('Введите инициалы: ');
- readln(fio);
- write('Введите номер телефона абонента: ');
- readln(Tel);
- writeln;
- write(f,s);end;
- until fam='#';
- end;
- close((F));
- end;
- Procedure file_search(isearch:string);
- Begin
- assign(f,nf);
- reset((F));
- with s do begin
- while not eof((F)) do begin
- read(f,s);
- if s.fam=isearch then begin
- writeln;
- write('Номер телефона абонента ',s.fam,' - ',s.tel);end;
- end;
- end;
- end;
- procedure OKNO(x1,y1,x2,y2,c1,c2:integer);
- begin
- textbackground(0);clrscr;
- textbackground(c1);
- textcolor(c2);
- window(x1,y1,x2,y2);clrscr;
- clrscr;
- end;
- function okfile(fl:string):boolean;
- begin
- {$I-}
- okfile:=false;
- assign(f1,fl);
- reset(f1);close(f1);
- {$I+}
- if ioresult=0 then okfile:=true;
- end;
- begin
- OKNO(5,5,55,21,124,255);
- nf:='С:/f1.txt';
- writeln('Введите фамилию: ');
- readln(isearch);
- if not okfile(nf) then
- file_cr(nf);
- file_search(isearch);
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement