Хто знает как работает процедура gotoxy. :low:
И еще: работает ли она при работе с файлами?
Если нет, то можна написать самому такую процедуру. :ryg:
procedure _GotoXY(var T : Text; x, y : integer);
var
count : integer;
s : string;
begin
count := 1;
readln(f, s);
while not(EOF(T)) and (count <> y) do begin
readln(f, s);
inc(count);
end;
if (count = y)and(x<=length(s)) then
writeln(s[x])
else exit;
end;
Program FindText;
uses crt;
var str,str1,find:string;
i,j:integer;
Begin
clrscr;
textcolor(white);
writeln('Please, enter the text ');
readln(str);
writeln('Enter the word you want to find');
readln(find);
j:=0;
str1:='';
for i:=1 to length(str) do
begin
if str[i]=' ' then
begin
if str1=find then
begin
textcolor(red);
write(str1,' ');
textcolor(white);
inc(j);
end
else write(str1,' ');
inc(i);
str1:='';
end;
str1:=str1+str[i];
end;
if j=0 then
begin
writeln;
write('In this text there is not word ',find);
end;
readln;
end.
for i:=1 to length(str) do
begin
if str[i]=' ' then
begin
if str1=find then
begin ... end
else write(str1,' ');
inc(i); { <--- Здесь !!! }
str1:='';
end;
str1:=str1+str[i];
end;
program FindText;
uses crt;
var
s, str, find: string;
p: byte;
begin
clrscr;
textcolor(lightgray);
writeln('Please, enter the text ');
readln(str);
s := str;
writeln('Enter the word you want to find');
readln(find);
repeat
p := pos(find, str);
if p > 0 then begin
write( copy(str, 1, p - 1) );
textcolor(lightred);
write(find);
textcolor(lightgray);
delete(str, 1, p + length(find) - 1)
end;
until p = 0;
writeln(str);
if str = s then writeln('no word: ', find);
readln;
end.
program FindText;
uses crt;
var
str, find: string;
p, plast: byte;
change_count: integer;
begin
clrscr;
textcolor(lightgray);
change_count := 0;
write('Please, enter the text ');
readln(str);
{ str := 'this is the goes test of gogoes'; }
write('Enter the word you want to find');
readln(find);
{ find := 'goes'; }
repeat
p := pos(find, str); plast := p;
if p > 0 then begin
while (p > 0) and (str[p - 1] <> ' ') do dec(p);
while (plast <= length(str)) and (str[plast + 1] <> ' ') do inc(plast);
if (copy(str, p, plast - p + 1) = find) then begin
write( copy(str, 1, p - 1) );
textcolor(lightred); write(find); textcolor(lightgray);
inc(change_count);
delete(str, 1, p + length(find) - 1)
end
else begin
write( copy(str, 1, plast - 1) );
delete(str, 1, plast - 1);
end;
end;
until p = 0;
writeln(str);
if change_count = 0
then writeln('no word: ', find);
readln;
end.