|
|
|
|
Bonjour,
j'aimerais bien que quelqu'un de "pro" me traduise ce code en langage C , merci d'avance :
voici le code :
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;
Configuration: Windows Vista Firefox 3.0.10
Bonjour , svp jai besoin d'aide par rapport a l'affichage d'un arbre n aire. Je vx afficher mon arbre sous la forme suivante par ex :
racine de l'arbre
/
/
A-----C-------E
| | |
R H C
| / |
B A---I O
| | | |
R T E L
| | |
E N E
et voici ce que jai fait : void afficher_arbre(struct noeud *p) { printf("\n%c",p->c); if(p->fils!=NULL) { printf("\n|"); afficher_arbre(p->fils); } if(p->frd!=NULL) { printf(" --"); afficher_arbre(p->frd); } } merci d'avance de votre aide |