procedure Classer ( Produit : in T_Tableau; Tabclas : out T_Tableau) is -- procedure classer tableau --prec : Produit_rupt est un tableau valide --post : produits classés I : Integer; -- B : Boolean; -- C : Boolean; -- K : Integer; -- Der : Integer; Ordrec : Character; Critere : Character; Permut : Boolean; Tabclaspro : T_Tableau; Ordrebool : Boolean; Ecraser : Character; begin Put_Line ("quel critere ::: (a)numero du produit, (b)quantite en stock, (c)quantite en sortie, (d)seuil. "); Get (Critere); Put_Line ("ordre (c)roissant ou (d)ecroissant ?"); Get (Ordrec); case Ordrec is when 'c' => Ordrebool:=True; when 'd' => Ordrebool := False; when others=> null; end case; case Critere is --********************************** --num when 'a' => Permut := True; while Permut = True loop Permut := False; I:=1; while Produit(I+1).Num/=(Fini) and I+1<=Derlig loop --Put (I); if Ordrebool=True then if Produit(I).Num > Produit(I+1).Num then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; else if Produit(I).Num < Produit(I+1).Num then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; end if; I:=I+1; end loop; end loop; --put_line("marqueB"); --put (I); Tabclas(I+1).Num:=Fini; --********************************** --********************************** --Qi when 'b' => Permut := True; while Permut = True loop Permut := False; I:=1; while Produit(I+1).Num/=(Fini) and I+1<=Derlig loop -- Put (I); if Ordrebool=True then if Produit(I).Qi > Produit(I+1).Qi then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; else if Produit(I).Qi < Produit(I+1).Qi then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; end if; I:=I+1; end loop; end loop; --put_line("marqueB"); --put (I); Tabclas(I+1).Num:=Fini; --********************************** --********************************** --Qs when 'c' => Permut := True; while Permut = True loop Permut := False; I:=1; while Produit(I+1).Num/=(Fini) and I+1<=Derlig loop -- Put (I); if Ordrebool=True then if Produit(I).Qs > Produit(I+1).Qs then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; else if Produit(I).Qs < Produit(I+1).Qs then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; end if; I:=I+1; end loop; end loop; --put_line("marqueB"); --put (I); Tabclas(I+1).Num:=Fini; --********************************** --********************************** --seuil when 'd' => Permut := True; while Permut = True loop Permut := False; I:=1; while Produit(I+1).Num/=(Fini) and I+1<=Derlig loop -- Put (I); if Ordrebool=True then if Produit(I).Seuil > Produit(I+1).Seuil then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; else if Produit(I).Seuil < Produit(I+1).Seuil then Tabclaspro(I):=Tabclas(I); Tabclas(I):=Tabclas(I+1); Tabclas(I+1):=Tabclaspro(I); Permut := True; end if; end if; I:=I+1; end loop; end loop; --put_line("marqueB"); --put (I); Tabclas(I+1).Num:=Fini; --********************************** when others=> null; end case; Put_Line ("attention, votre tableau sera ecrase par le nouveau tableau"); Put_Line(" classe selon vos choix, voulez vous continuer ?"); Put_Line (" (o)ui pour confirmer, (n)on pour annuler."); Get (Ecraser); case Ecraser is when 'n' => null; when 'o'=> Put_Line("tableau ecrase"); when others => null; end case; end Classer;