Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  1
Language: PASCAL
Code:
const n=15;
type w=string[n];
     slovo=record
      eng,rus:w;
     end;
var f:file of slovo;
    en,ru:w;
    i,nn:integer;

procedure addW;
var en,ru:w;
    s:slovo;
begin
writeln('procedure AddW');
seek(f,filesize(f));
readln(en);
readln(ru);
s.eng:=en;s.rus:=ru;
write(f,s);
readln;
end;

procedure print(n:integer);
var s:slovo;t:integer;
begin
seek(f,0);
t:=0;
while (not eof(f)) and (t<n) do begin
read(f,s);
writeln(s.eng,'-',s.rus);
t:=t+1;
end;
readln
end;

procedure test;
begin
writeln('procedure test');
end;

begin
assign(f,'slovar.dat');
{$i-}
Reset(f);
{$i+}
if IOResult=0 then
 writeln('dobavlenie zapisey v sysh file')
else
 begin
 rewrite(f);
 writeln('zapis v new file');
 end;
writeln('1-addW,2-test,3-print,4-exit');
writeln('N menu');
repeat
begin
write('i=');
readln(i);
case i of
1:addW;
2:test;
3:begin
  read(nn);
  print(nn);
  end;
end
end
until i>=4
end.     
          
Comments: