Commit 264d2b593502431d469c8ec01dfb7a63f553123b
1 parent
131759ee
debut verif orthographe -OK 1 mot
Showing
3 changed files
with
43 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,31 @@ | @@ -0,0 +1,31 @@ | ||
1 | +#include "find.h" | ||
2 | + | ||
3 | + | ||
4 | +int find_mot(struct node **tab_ptr_tree,char mot[],int size,int fl) | ||
5 | +{ | ||
6 | + if(size==0 || (size==1 && tab_ptr_tree[fl]!=NULL))return 0;//vrais | ||
7 | + if(size==1 && tab_ptr_tree[fl]==NULL)return 1;//faux | ||
8 | + | ||
9 | + struct node *ptr_node = tab_ptr_tree[fl]; | ||
10 | + for(int i=1;i<size;i++) | ||
11 | + { | ||
12 | + if(ptr_node->nbr_fils==0)return 1; | ||
13 | + for(int k=0;k<(ptr_node->nbr_fils);k++) | ||
14 | + { | ||
15 | + //if(ptr_node->fils[k]->nbr_fils==0)return 1; | ||
16 | + if(ptr_node->fils[k]->val==mot[i]) | ||
17 | + { | ||
18 | + ptr_node=ptr_node->fils[k]; | ||
19 | + break; | ||
20 | + } | ||
21 | + } | ||
22 | + } | ||
23 | + | ||
24 | + if(ptr_node->fin==0)return 1; | ||
25 | + else return 0; | ||
26 | +} | ||
27 | + | ||
28 | +int find() | ||
29 | +{ | ||
30 | + return 0; | ||
31 | +} | ||
0 | \ No newline at end of file | 32 | \ No newline at end of file |
1 | -#include "tree.h" | ||
2 | #include "find.h" | 1 | #include "find.h" |
3 | 2 | ||
4 | int main() | 3 | int main() |
@@ -19,6 +18,13 @@ int main() | @@ -19,6 +18,13 @@ int main() | ||
19 | 18 | ||
20 | printf("Loading done!\n"); | 19 | printf("Loading done!\n"); |
21 | 20 | ||
21 | + char mot[] = "aaa"; | ||
22 | + int taille = 3; | ||
23 | + int result; | ||
24 | + result = find_mot(tab,mot,taille,0); | ||
25 | + printf("%d\n",result); | ||
26 | + | ||
27 | + | ||
22 | free_dico(tab);//libérer la mémoire | 28 | free_dico(tab);//libérer la mémoire |
23 | fclose(fp); | 29 | fclose(fp); |
24 | 30 |