remover removendo

This commit is contained in:
2026-06-30 10:59:07 -03:00
parent ffb62558bd
commit f86bf7c198
+18 -11
View File
@@ -32,7 +32,7 @@ function validacaoDeInexistencialismoDeOutroCadastroDePessoasFisicaDentroDaLista
begin
aux := cpfs[(charint(cpf[10]) *10+ charint(cpf[11]))];
existenciaDeTalInformacaoNaLista := false;
while (aux^.prox <> nil) and (not existenciaDeTalInformacaoNaLista) do
while (aux <> nil) and (not existenciaDeTalInformacaoNaLista) do
begin
if (cpf = aux^.cpf) then
existenciaDeTalInformacaoNaLista := true
@@ -158,22 +158,29 @@ procedure buscar(var cpfs:thash;cpf:string);
procedure removerCPF(var cpfs:thash;cpf:string) ;
var
aux:^ptcpf;
aux2:^ptcpf;
ant:^ptcpf;
achou:boolean;
begin
achou:=false;
aux := cpfs[ (charint(cpf[10]) *10+ charint(cpf[11])) ];
while (aux <> nil) and (not achou) do
while (aux <> nil) and (aux^.cpf <> cpf) do
begin
if(aux^.cpf = cpf) then
begin
achou:=true;
aux2:=(aux^.prox) ;
end
else
aux:= aux^.prox
end;
ant := aux;
aux := aux^.prox;
end;
if aux <> nil then
begin
if ant = nil then
cpfs[(charint(cpf[10]) *10+ charint(cpf[11]))] := aux^.prox
else
ant^.prox := aux^.prox;
dispose(aux);
end;
end;
procedure cpfsInicializar ( var cpfs : thash ) ;
var
i : integer ;