when i execute my program this error message apparaît (Runtime erro 152 at S000000001000001BFC S0000001000001BFC ligne 79 of project12.lpr $00000000100001CC6)
program app;
uses wincrt;
var
n:integer;
ph,phcr:text;
function alpha (ch:string):boolean;
var
b:boolean;
i:integer;
begin
b:=true;
i:=1;
repeat
if (ch in ['A'..'Z',' ']) then
i:=i+1
else
b:=false;
until ((not(b)) or (i>length(ch))) ;
alpha:=b;
end;
procedure remplir (var f:text;n:integer);
var
ch:string;
i:integer;
begin
reset(f);
for i:= 1 to n do
begin
repeat
write('saisir la chaine ',i,': ');readln(ch);
until (pos(' ',ch)=0) and (alpha(ch));
writeln(f,ch);
end;
close(f);
end;
procedure crypt(var f,ff:text);
var
p,i:integer;
ch:string;
begin
reset(f);
reset(ff);
while not(eof(f)) do
begin
p:=random(5)+1;
readln(f,ch);
for i := 1 to length (ch) do
if (ch <> ' ') then
if ord(ch)+p > ord ('Z') then
ch:=chr(ord(ch)+p - ord ('Z')+64)
else
ch:= chr(ord(ch)+p);
writeln(ff,ch);
end;
close(f);
close(ff);
end;
procedure affiche (var f:text);
var
ch:string;
begin
reset(f);
while not(eof(f)) do
begin
readln(f,ch);
writeln(ch);
end;
close(f);
end;
begin
assign(ph,'D:\bec\prases.txt');
assign(phcr,'D:\bec\ph_crypt.txt'); {creation des fichiers}
rewrite(ph);
rewrite(phcr);
repeat
write('N=');readln(n); {le nombre des chaines}
until (n<=20);
remplir(ph,n); {remplissage de phrase.txt}
crypt(ph,phcr); {cryptage des chaines}
affiche(phcr); {affichage du fichier crypté}
end.