Fermer2
onurLe 31/07/2005 à 00:48
Voila. J'ai une classe Noeud. Et j'aimerais faire une fonction d'affichage en mode console (avec uniqement printf sans cout) qui affiche l'arbre. Les noeud ont entre 0 et n fils.

sur le net j'ai trouvé ca, mais cest pas en mode console:
procedure arbre.dessine(en_cours: noeud; limg, old_x, old_y: integer); var x, y, nb: integer;   i: char; begin //nb:=compter_terminaux(courant); // effet joli   nb := compter_terminaux(en_cours);   x := limg + (50 * nb) div 2;   y := old_y + 80;   if en_cours <> tete then     with form1.image1.picture.bitmap.canvas do     begin       textout(x, y, en_cours.lettre);       en_cours.x := x; en_cours.y := y;       moveto(x, y - 5); lineto(old_x, old_y);     end;   for i := 'A' to 'Z' do     if en_cours.fils[i] <> nil then     begin       nb := compter_terminaux(en_cours.fils[i]);       dessine(en_cours.fils[i], limg, x, y + 20);       limg := limg + nb * 50;     end; end;