Commit fc2a89b19aab935ddc0da4d56082348b5e6548cd

Authored by rsimonin
1 parent 7a7157b0

con

Showing 1 changed file with 10 additions and 11 deletions   Show diff stats
... ... @@ -45,7 +45,7 @@ void cons_dico(struct dico **ppt_dico,char val){
45 45 }
46 46  
47 47 void ini_dico(struct dico * pt_dico){
48   - printf("ini_dico");
  48 + printf("ini_dico\n");
49 49 for(int i=0;i<26;i++){
50 50 cons_dico(&pt_dico,'a'+i);
51 51 }
... ... @@ -61,27 +61,26 @@ void ajout_mot(struct arbre **pt_arbre,char *mot, int i){
61 61 Arbre *monarbre=malloc(sizeof(struct arbre));
62 62 monarbre->val=mot[i];
63 63 monarbre->finmot=false;
64   - for(int i=0;i<26;i++){
65   - monarbre->suite[i]=NULL;
  64 + for(int j=0;j<26;j++){
  65 + monarbre->suite[j]=NULL;
66 66 }
67 67 pt_arbre=&monarbre;
68 68 printf("%c\n",(*pt_arbre)->val);
69 69  
70 70 }
71 71 i++;
72   - ajout_mot(pt_arbre,mot,i);
  72 + ajout_mot(&((*pt_arbre)->suite[mot[i]-'a']),mot,i);
73 73 }
74   -// (*pt_arbre)->finmot=true;
75   -// printf("true\n");
  74 +
76 75 }
77 76  
78 77 void charger_arbre(FILE *fp, struct dico **ppt_dico)
79 78 { char mot[20];
80 79 ini_dico(*ppt_dico);
81   - while (fscanf(fp, "%s", mot)!=EOF){
82   - printf("\nmot:%s\n",mot);
83   - printf("%c\n",(*ppt_dico)->alpha[mot[0]-'a']->val);
84   - ajout_mot(&((*ppt_dico)->alpha[mot[0]-'a']),mot,0);
  80 + while (fscanf(fp, "%s", mot)==1){
  81 + int i=0;
  82 + printf("mot:%s\n",mot);
  83 + ajout_mot(&((*ppt_dico)->alpha[mot[0]-'a']),mot,i);
85 84 }
86 85 return ;
87 86 }
... ... @@ -126,7 +125,7 @@ void affiche_dico(struct dico *dico){
126 125 }
127 126 printf("---------------------------------------\n");
128 127 for(int i=0;i<26;i++){
129   - printf("%dmot:",i);
  128 + printf("%d:",i);
130 129 affiche_arbre(dico->alpha[i]);
131 130 printf("\n");
132 131 }
... ...