Problemita con lista
Publicado por JUan (83 intervenciones) el 05/07/2007 22:22:41
A ver si me dicen que es lo que esta mal acá? poruqe no me deja compilar estos modulos.
program lista;
type
tipoinfo=word;
tipolista=^tiponodo;
tiponodo=record
info:tipoinfo;
sgte:tipolista;
end;
Arch=file of tipolista;
Procedure InsertaInicio(var lista:tipolista;valor:tipoinfo);
var ptrN:tipolista;
begin
new(ptrN);
ptrN^.info:=valor;
prtN^.sgte:=lista; (* en esta linea me dice identifier not found "ptrN") porque?*)
lista:=ptrN;
end;
Procedure InsertaEnMedio(var lista:tipolista;valor:tipoinfo);
var ptrN,ptrAct:tipolista;
Begin
new(ptrN);
ptrN^.Info:=valor;
ptrAct:=lista;
While ((ptrAct^.sgte<>nil) and (Valor>ptrAct^.sgte^.info)) do
ptrAct:=ptract^.sgte;
ptrN^.sgte:=ptrAct^.sgte;
ptrAct^.sgte:=ptrN
end;
Procedure InsertaNodo(var lista:tipolista;valor:tipoinfo);
Begin
If ((lista=nil) or (valor<lista^.info))
then
InsertaInicio(lista,Valor);
else
InsertaEnMedio(lista,Valor)
end;
end;
Procedure SuprimeNodo(var lista:tipolista;valor:tipoinfo);
var ptrAnt,ptrAct:tipolista;
begin
ptrAct:=lista;
ptrAnt:=nil;
while ((ptrAct<>nil) and (valor>ptrAct^.Info)) do
ptrAnt:=ptract;
ptrAct:=ptrAct^.sgte;
end;
If ((ptrAct<>nil) and (valor=ptrAct^.Info))
then
if ptrAnt=nil
then
lista:=lista^.sgte;
else
ptrAnt^.sgte:=ptrAct^.sgte;
end;
dispose(ptract)
end;
end;
program lista;
type
tipoinfo=word;
tipolista=^tiponodo;
tiponodo=record
info:tipoinfo;
sgte:tipolista;
end;
Arch=file of tipolista;
Procedure InsertaInicio(var lista:tipolista;valor:tipoinfo);
var ptrN:tipolista;
begin
new(ptrN);
ptrN^.info:=valor;
prtN^.sgte:=lista; (* en esta linea me dice identifier not found "ptrN") porque?*)
lista:=ptrN;
end;
Procedure InsertaEnMedio(var lista:tipolista;valor:tipoinfo);
var ptrN,ptrAct:tipolista;
Begin
new(ptrN);
ptrN^.Info:=valor;
ptrAct:=lista;
While ((ptrAct^.sgte<>nil) and (Valor>ptrAct^.sgte^.info)) do
ptrAct:=ptract^.sgte;
ptrN^.sgte:=ptrAct^.sgte;
ptrAct^.sgte:=ptrN
end;
Procedure InsertaNodo(var lista:tipolista;valor:tipoinfo);
Begin
If ((lista=nil) or (valor<lista^.info))
then
InsertaInicio(lista,Valor);
else
InsertaEnMedio(lista,Valor)
end;
end;
Procedure SuprimeNodo(var lista:tipolista;valor:tipoinfo);
var ptrAnt,ptrAct:tipolista;
begin
ptrAct:=lista;
ptrAnt:=nil;
while ((ptrAct<>nil) and (valor>ptrAct^.Info)) do
ptrAnt:=ptract;
ptrAct:=ptrAct^.sgte;
end;
If ((ptrAct<>nil) and (valor=ptrAct^.Info))
then
if ptrAnt=nil
then
lista:=lista^.sgte;
else
ptrAnt^.sgte:=ptrAct^.sgte;
end;
dispose(ptract)
end;
end;
Valora esta pregunta


0