Bonsoir,
je réalise un programme qui crée un arbre généalogique à partir d'un arbre binaire
Il y a un structure NOEUD revoie vers le nom de la personne, un numero, un pere, un poiteur gauche et un pointeur droit.
Le programme pause des questions de maière récurssive : créér un frére, un fils....
Mais le probleme c 'est que je n'arrive pas a compiler ce programme sous dev c++ ... si vous avez un idée
Merci
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
typedef struct NOEUD
{
char *Nom;
int *num;
struct NOEUD *pere;
struct NOEUD *ptg;
struct NOEUD *ptd;
}NOEUD;
NOEUD *creer(){
NOEUD *pvide=NULL; // initialisation pcour
pvide= (NOEUD*)malloc(sizeof(NOEUD));
//pvide->Nom = (char*)malloc(10);
pvide->pere=NULL;
pvide->ptg=NULL;
pvide->ptd=NULL;
return pvide;
}
NOEUD*fairefils(NOEUD*prec,NOEUD*pcourant)
{pcourant->pere=prec;
prec->ptg=pcourant;
}
NOEUD*fairefrere(NOEUD*prec,NOEUD*pcourant)
{pcourant->pere=prec;
prec->ptd=pcourant;
}
void contruction_arbre(NOEUD*prec){
int choix;
printf("voulez-vous créer un fils à %s (1-oui,2-non)\n",*prec->Nom );
scanf ("%d",&choix);
if (choix==1)
{
NOEUD *pcourant;
pcourant=creer();
printf( "entrez le nom/n");
scanf("%s",pcourant->Nom);
fairefils(prec,pcourant);
contruction_arbre(pcourant);
}
printf("voulez-vous créer un frere à %s (1-oui,2-non)\n",*prec->Nom );
scanf ("%d",&choix);
if (choix==1)
{
NOEUD *pcourant;
pcourant=creer();
printf( "entrez le nom/n");
scanf("%s",pcourant->Nom);
fairefils(prec,pcourant);
contruction_arbre(pcourant);
}
}