program lol; uses crt; label metka1, metka2, metka3; const old='price.dat'; type Pprice=record Pname:string[20]; Pvalue:real; end; var price:file of Pprice; newprice:file of Pprice; p:pprice; i,n,z,x:integer; procedure vivod; begin reset(price); while not eof(price) do begin read(price,p); write(p.pname:10); writeln(p.pvalue:10:2); writeln; end; close(price); end; begin clrscr; begin {' otkritie '} assign(newprice,'C:\newprice.dat'); assign(price,'C:\price.dat'); write('noviy file - 0, redakt - 1 '); readln(i); if i=0 then rewrite(price) else reset(price); end; begin {' dobavlenie '} write('dobavit? da - 1, net - 0 '); readln(n); if n=1 then begin metka1: seek(price,filesize(price)); write('vvedite na3vanie tovara '); read(p.pname); write('vvedite na3vanie ceni '); read(p.pvalue); write(price,p); write('dobavit? da - 1, net - 0 '); readln(n); if n=1 then goto metka1; end; close(price); end; vivod; begin {' i3menenie '} reset(price); write('dobavit? da - 1, net - 0 '); readln(n); if n=1 then begin metka2: write('vvedite nomer stroki dlia i3meneniya '); readln(i); seek(price,i-1); write('vvedite na3vanie tovara '); read(p.pname); write('vvedite na3vanie ceni '); read(p.pvalue); write(price,p); write('eshe redaktirovat? da - 1, net - 0 '); readln(n); if n=1 then goto metka2; end; close(price); end; vivod; begin {' ydalenie '} write('ydaliaem 3apis? da - 1, net - 0 '); readln(n); if n=1 then begin metka3: reset(price); rewrite(newprice); write('vvedite nomer stroki dlia ydaleniya '); readln(i); while not eof(price) do begin read(price,p); if filepos(price)<>i then write(newprice,p); end; close(newprice); close(price); erase(price); rename(newprice,old); assign(price,'C:\price.dat'); write('eshe ydaliaem? da - 1, net - 0 '); readln(n); if n=1 then goto metka3; end; end; readln; end.