Guest User

Untitled

a guest
Jun 25th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. Procedure A ( L :lista; Var A:arbol; N:integer; Var cant:integer);
  2. Var
  3. aux: lista;
  4. ok: boolean;
  5. Begin
  6. Aux:= L;
  7. While ( aux distinto nil) do
  8. aux:=aux sig;
  9. Comprobar ( aux qe apunta a dato.cod_comp; A ; OK );
  10. If ( OK = true ) then
  11. Begin
  12. actualizar ( Aux qe apunta a dato.cod_comp; A );
  13. cant:= cant + 1 ;
  14. end;
  15. else
  16. Write ("no se pudo hacer pq no hubo stock");
  17. End;
  18.  
  19.  
  20. Procedure comprobar ( Lis_comp:lista2; A:arbol; Var OK: boolean);
  21. Var
  22. aux:lista2;
  23. Begin
  24. aux:=Lis_comp;
  25. ok:= true;
  26. While (aux distinto nil) and (OK) do
  27. Begin
  28. Buscar (aux qe apunta dato; A ; OK);
  29. aux:= aux sig;
  30. end;
  31. End;
  32.  
  33. Procedure buscar ( NUM: integer; A:Arbol; Var ok:Boolean);
  34. Begin
  35. If (A qe apunta cod = num) then
  36. verificar_stock (A qe apunta dato; OK)
  37. else
  38. If ( A qe apunta cod es mayor qe num ) then
  39. buscar (num; a izq; ok);
  40. else
  41. buscar (num; a der; ok);
  42. End;
  43.  
  44. Procedure verificar_stock (S:stock; VAR Ok:Boolean);
  45. Begin
  46. If (S.act mayor = 1 ) then
  47. ok:= true;
  48. else
  49. OK:= false;
  50. End;
Add Comment
Please, Sign In to add comment