Commit 264d2b593502431d469c8ec01dfb7a63f553123b

Authored by Thorsieger
1 parent 131759ee

debut verif orthographe -OK 1 mot

Showing 3 changed files with 43 additions and 1 deletions   Show diff stats
find.c 0 → 100644
... ... @@ -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 32 \ No newline at end of file
... ...
find.h 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +#include "tree.h"
  2 +
  3 +int find();
  4 +
  5 +int find_mot(struct node **,char*,int,int);
0 6 \ No newline at end of file
... ...
1   -#include "tree.h"
2 1 #include "find.h"
3 2  
4 3 int main()
... ... @@ -19,6 +18,13 @@ int main()
19 18  
20 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 28 free_dico(tab);//libérer la mémoire
23 29 fclose(fp);
24 30  
... ...