Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Procedure A ( L :lista; Var A:arbol; N:integer; Var cant:integer);
- Var
- aux: lista;
- ok: boolean;
- Begin
- Aux:= L;
- While ( aux distinto nil) do
- aux:=aux sig;
- Comprobar ( aux qe apunta a dato.cod_comp; A ; OK );
- If ( OK = true ) then
- Begin
- actualizar ( Aux qe apunta a dato.cod_comp; A );
- cant:= cant + 1 ;
- end;
- else
- Write ("no se pudo hacer pq no hubo stock");
- End;
- Procedure comprobar ( Lis_comp:lista2; A:arbol; Var OK: boolean);
- Var
- aux:lista2;
- Begin
- aux:=Lis_comp;
- ok:= true;
- While (aux distinto nil) and (OK) do
- Begin
- Buscar (aux qe apunta dato; A ; OK);
- aux:= aux sig;
- end;
- End;
- Procedure buscar ( NUM: integer; A:Arbol; Var ok:Boolean);
- Begin
- If (A qe apunta cod = num) then
- verificar_stock (A qe apunta dato; OK)
- else
- If ( A qe apunta cod es mayor qe num ) then
- buscar (num; a izq; ok);
- else
- buscar (num; a der; ok);
- End;
- Procedure verificar_stock (S:stock; VAR Ok:Boolean);
- Begin
- If (S.act mayor = 1 ) then
- ok:= true;
- else
- OK:= false;
- End;
Add Comment
Please, Sign In to add comment