Answer the question
In order to leave comments, you need to log in
Is the result not being written to a file?
There is a code according to which you need to check the match between the file first and massive and write the result to rezult
here is the code
var
first,massive,rezult: text ;
str1,str2:string;
i,n,t,y:integer;
begin
AssignFile(first,'c:\way\first.txt');
reset(first);
AssignFile(massive,'c:\way\massive.txt');
reset(massive);
AssignFile(rezult,'c:\way\new.txt');
while not EOF(first) do
begin
Readln(first,str1);
while not EOF(massive) do
begin
Readln(massive,str2);
y:=pos(str1,str2);
if (y<>0)then
begin
rewrite(rezult);
writeln(rezult,str2);
end ;
end;
end;
close(first);
close(massive);
close(rezult);
end.
Answer the question
In order to leave comments, you need to log in
rewrite(result); - reopens the file, clearing it. You do it in a loop every time
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question