(проблема в доработки процедуры ChangeElement). Помогите пожалуйста...
const n=8;
Type
point = ^MyWord;
MyWord = record
ch: char;
next: point
end;
Type massiv = array[1..n] of char;
var
slovo:point;
c:char;
M,m1:massiv;
E1,E2: string[100];
i:integer;
{---------------------------------------------------------------------------}
Procedure VvodEl(var mas:massiv;MyStr:string);
var i:integer;
begin
for i:=1 to length(MyStr) do mas[i]:=MyStr[i];
end;
{---------------------------------------------------------------------------}
procedure Print (first: point);
Var r: point;
begin
R:= first;
write('CLOBO = ');
While r<>nil do
begin
Write (r^.ch);
R:=r^.Next;
end;
writeln;
end;
{---------------------------------------------------------------------------}
procedure Vvod(var first: point);
var r, last: point;
begin
first:= nil; last := nil;
writeln('HABEPuTE C/\OBO C "." HA KOHCE ');
repeat
new( r );
r^.next := nil;
read(r^.ch);
if first = nil then first := r
else last^.next := r;
last := r;
until r^.ch = '.';
end;
{---------------------------------------------------------------------------}
procedure ChangeElement(first:point;C:massiv;c1:massiv);
var r,p:point;
j:integer;
bad: boolean;
begin
r := first;
repeat
{ while (i <= length(E2)) and (C[1] <> r^.ch) do inc(i); }
if r <> nil then begin
j := 1;
p:=r;
bad := false;
while (p^.ch <> '.') and (not bad) do
begin
bad := (p^.ch) <> C[j];
if not bad then
begin
p := p^.next;
inc(j)
end
end;
if c[j]<>#0 then r:=r^.next
else
begin
r := p;
{?????????????????????}
end
end
until r = nil
end;
{--------------------------------------------------------------------------}
begin
clrscr;
readln(E2);
VvodEl(m,E2);
readln(E1);
VvodEl(m1,E1);
vvod(slovo);
writeln('Start word:');
print(slovo);
ChangeElement(slovo,M,M1);
writeln('Finish word:');
print(slovo);
readkey
end.
Сообщение отредактировано: NTL -