remover removendo

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