program zad_29_31;
uses crt;
type owner=record
tip:string[30];
Unom:integer;
Pnom:real;
Wnom:integer;
Mnom:real;
KPD:real;
end;
var karta:owner;
f:file of owner;
fname:string;
tip_:string;
Unom_:integer;
Pnom_:real;
Wnom_:integer;
Mnom_:real;
KPD_:real;
ch:char;
procedure enter(fname:string);
var
ch1:char;
begin
assign(f,fname);
rewrite(f);
while ch1<>'n' do begin
ClrSCr;
seek(f,FileSize(f));
write('tip dvigatelya: ');
readln(karta.tip);
write('nominalnoe napryajenie: ');
readln(karta.Unom);
write('nominalnaya moschnost: ');
readln(karta.Pnom);
write('nominalnoe chastota vraschenia: ');
readln(karta.Wnom);
write('nominalnyi moment vraschenia: ');
readln(karta.Mnom);
write('KPD: ');
readln(karta.KPD);
write(f,karta);
writeln('dannye vneseny v fail');
write('povtorit vvod? (y/n)');
readln(ch1);
end;
writeln('dlya vozvrata v glavnoe menu - Enter');
readln;
close(f);
end;
procedure dop;
var ch1:char;
begin
assign(f,fname);
reset(f);
seek(f,filesize(f));
writeln('**************************************');
writeln('novye dannye');
writeln('**************************************');
write('tip dvigatelya: ');
readln(karta.tip);
write('nominalnoe napryajenie: ');
readln(karta.Unom);
write('nominalnaya moschnost: ');
readln(karta.Pnom);
write('nominalnoe chastota vraschenia: ');
readln(karta.Wnom);
write('nominalnyi moment vraschenia: ');
readln(karta.Mnom);
write('KPD: ');
readln(karta.KPD);
write(f,karta);
writeln('dannye vneseny v fail');
write('povtorit vvod? (y/n)');
readln(ch1);
writeln('dlya vozvrata v glavnoe menu - Enter');
readln;
close(f);
end;
procedure del(fname:string; tip_:string);
var
BEGIN
repeat
ClrSCr;
writeln('1.sozdat fail');
writeln('2.dobavit dannye');
writeln('3.ydalit dannye');
writeln('4.prosmotr dannih');
writeln('5.exit');
ch:=readkey;
case ch of
#49: begin
ClrSCr;
write('pyt i imya faila: ');
readln(fname);
enter(fname);
end;
#50: begin
write('pyt i imya faila: ');
readln(fname);
dop;
end;
#51:begin
write('pyt i imya faila: ');
readln(fname);
del;
end;
#52:begin
end; }
end;
until ch=#53;
exit;
END.
удаление строки данных из типизированного файла |