Commit 0164603a44dcfc96639d69774b0cb247571f7f6e
1 parent
6277885a
affichage
Showing
1 changed file
with
52 additions
and
52 deletions
Show diff stats
arbre.c
@@ -47,7 +47,7 @@ bool mot_existe(struct arbre *monarbre,char *mot,int i){ | @@ -47,7 +47,7 @@ bool mot_existe(struct arbre *monarbre,char *mot,int i){ | ||
47 | 47 | ||
48 | void ini_dico(struct dico *pt_dico) | 48 | void ini_dico(struct dico *pt_dico) |
49 | { | 49 | { |
50 | - printf("ini_dico\n"); | 50 | + printf("Initialisation du dictionnaire\n"); |
51 | for(int i=0;i<TAILLE;i++){ | 51 | for(int i=0;i<TAILLE;i++){ |
52 | pt_dico->alpha[i]=NULL; | 52 | pt_dico->alpha[i]=NULL; |
53 | } | 53 | } |
@@ -76,7 +76,7 @@ void ajout_mot(struct arbre **arbrecourant,char *mot,int i) | @@ -76,7 +76,7 @@ void ajout_mot(struct arbre **arbrecourant,char *mot,int i) | ||
76 | creation_arbre(arbrecourant,mot[i]); | 76 | creation_arbre(arbrecourant,mot[i]); |
77 | } | 77 | } |
78 | if(mot[i+1]=='\0'){ | 78 | if(mot[i+1]=='\0'){ |
79 | - printf("mot:%s %c\n",mot,mot[i]); | 79 | + //printf("mot:%s %c\n",mot,mot[i]); |
80 | (*arbrecourant)->finmot=true; | 80 | (*arbrecourant)->finmot=true; |
81 | } | 81 | } |
82 | i++; | 82 | i++; |
@@ -164,53 +164,53 @@ void analyse_fichier(FILE *fp,Dico *pt_dico, int *nb_t, int *nb_f){ | @@ -164,53 +164,53 @@ void analyse_fichier(FILE *fp,Dico *pt_dico, int *nb_t, int *nb_f){ | ||
164 | *nb_f=nbmot_f; | 164 | *nb_f=nbmot_f; |
165 | } | 165 | } |
166 | 166 | ||
167 | -int main (int argc,char *argv[]){ | ||
168 | - FILE* dico = NULL; | ||
169 | - if(argc >1){ | ||
170 | - printf("chargement de votre dictionnaire \n"); | ||
171 | - dico=fopen(argv[1],"r"); | ||
172 | - } | ||
173 | -// else dico=fopen("words-no-accents","r"); | ||
174 | - | ||
175 | - if(dico == NULL){ | ||
176 | -// return EXIT_FAILURE; | ||
177 | - printf("chargement du dictionnaire par default"); | ||
178 | - dico=fopen("words-no-accents","r"); | ||
179 | - } //File is not readable | ||
180 | - | ||
181 | - struct dico *mondico=malloc(sizeof(struct dico)); | ||
182 | - charger_dico(dico,&mondico); | ||
183 | -// affiche_dico(mondico); | ||
184 | - fclose(dico); | ||
185 | - char mot[]="zombie"; | ||
186 | - char mot2[]="chaine"; | ||
187 | -// mot_existe(mondico->alpha[calculcase('r')],"rerere",0); | ||
188 | - //mot_existe(mondico->alpha[calculcase(mot2[0])],mot2,0); | ||
189 | - | ||
190 | - printf("1: %s:%d \n",mot,mot_existe(mondico->alpha[calculcase(mot[0])],mot,0)); | ||
191 | - printf("2: %s:%d \n",mot2,mot_existe(mondico->alpha[calculcase(mot2[0])],mot2,0)); | ||
192 | - | ||
193 | - FILE* fichier_utilisateur = NULL; | ||
194 | - if(argc >2){ | ||
195 | - printf("Analyse de votre fichier \n"); | ||
196 | - fichier_utilisateur=fopen(argv[2],"r"); | ||
197 | - printf("Fin Analyse de votre fichier \n"); | ||
198 | - } | ||
199 | - | ||
200 | - if (fichier_utilisateur!=NULL){ | ||
201 | - printf("analyse en cours\n"); | ||
202 | - int juste=0; | ||
203 | - int faux=0; | ||
204 | - analyse_fichier(fichier_utilisateur,mondico,&juste,&faux); | ||
205 | - printf("juste:%d \n",juste); | ||
206 | - printf("faux:%d \n",faux); | ||
207 | - } | ||
208 | - | ||
209 | - printf("fin programme \n"); | ||
210 | - free_dico(mondico); | ||
211 | - if (fichier_utilisateur!=NULL){ | ||
212 | - fclose(fichier_utilisateur); | ||
213 | - } | ||
214 | - | ||
215 | - return 0; | ||
216 | - } | 167 | +// int main (int argc,char *argv[]){ |
168 | +// FILE* dico = NULL; | ||
169 | +// if(argc >1){ | ||
170 | +// printf("chargement de votre dictionnaire \n"); | ||
171 | +// dico=fopen(argv[1],"r"); | ||
172 | +// } | ||
173 | +// // else dico=fopen("words-no-accents","r"); | ||
174 | +// | ||
175 | +// if(dico == NULL){ | ||
176 | +// // return EXIT_FAILURE; | ||
177 | +// printf("chargement du dictionnaire par default"); | ||
178 | +// dico=fopen("words-no-accents","r"); | ||
179 | +// } //File is not readable | ||
180 | +// | ||
181 | +// struct dico *mondico=malloc(sizeof(struct dico)); | ||
182 | +// charger_dico(dico,&mondico); | ||
183 | +// // affiche_dico(mondico); | ||
184 | +// fclose(dico); | ||
185 | +// char mot[]="zombie"; | ||
186 | +// char mot2[]="chaine"; | ||
187 | +// // mot_existe(mondico->alpha[calculcase('r')],"rerere",0); | ||
188 | +// //mot_existe(mondico->alpha[calculcase(mot2[0])],mot2,0); | ||
189 | +// | ||
190 | +// printf("1: %s:%d \n",mot,mot_existe(mondico->alpha[calculcase(mot[0])],mot,0)); | ||
191 | +// printf("2: %s:%d \n",mot2,mot_existe(mondico->alpha[calculcase(mot2[0])],mot2,0)); | ||
192 | +// | ||
193 | +// FILE* fichier_utilisateur = NULL; | ||
194 | +// if(argc >2){ | ||
195 | +// printf("Analyse de votre fichier \n"); | ||
196 | +// fichier_utilisateur=fopen(argv[2],"r"); | ||
197 | +// printf("Fin Analyse de votre fichier \n"); | ||
198 | +// } | ||
199 | +// | ||
200 | +// if (fichier_utilisateur!=NULL){ | ||
201 | +// printf("analyse en cours\n"); | ||
202 | +// int juste=0; | ||
203 | +// int faux=0; | ||
204 | +// analyse_fichier(fichier_utilisateur,mondico,&juste,&faux); | ||
205 | +// printf("juste:%d \n",juste); | ||
206 | +// printf("faux:%d \n",faux); | ||
207 | +// } | ||
208 | +// | ||
209 | +// printf("fin programme \n"); | ||
210 | +// free_dico(mondico); | ||
211 | +// if (fichier_utilisateur!=NULL){ | ||
212 | +// fclose(fichier_utilisateur); | ||
213 | +// } | ||
214 | +// | ||
215 | +// return 0; | ||
216 | +// } |