Commit 76053da1a5fe62cc996723abe5a0134b918758fe
1 parent
89b9e3f8
update des fichiers
Showing
5 changed files
with
40 additions
and
44 deletions
Show diff stats
find.c deleted
@@ -1,36 +0,0 @@ | @@ -1,36 +0,0 @@ | ||
1 | -#include "find.h" | ||
2 | - | ||
3 | - | ||
4 | -int find_mot(struct node **tab_ptr_tree,wchar_t mot[],int size,int fl) | ||
5 | -{ | ||
6 | - if(size==1 && tab_ptr_tree[fl]!=NULL) | ||
7 | - { | ||
8 | - if(tab_ptr_tree[fl]->fin==0)return 1; | ||
9 | - else return 0;//vrais | ||
10 | - } | ||
11 | - if(size==1 && tab_ptr_tree[fl]==NULL)return 1;//faux | ||
12 | - | ||
13 | - struct node *ptr_node = tab_ptr_tree[fl]; | ||
14 | - for(int i=1;i<size;i++) | ||
15 | - { | ||
16 | - if(ptr_node->nbr_fils==0)return 1; | ||
17 | - for(int k=0;k<(ptr_node->nbr_fils);k++) | ||
18 | - { | ||
19 | - //if(ptr_node->fils[k]->nbr_fils==0)return 1; | ||
20 | - if(ptr_node->fils[k]->val==mot[i]) | ||
21 | - { | ||
22 | - ptr_node=ptr_node->fils[k]; | ||
23 | - break; | ||
24 | - } | ||
25 | - else if(k+1==ptr_node->nbr_fils)return 1; | ||
26 | - } | ||
27 | - } | ||
28 | - | ||
29 | - if(ptr_node->fin==0)return 1; | ||
30 | - else return 0; | ||
31 | -} | ||
32 | - | ||
33 | -int find() | ||
34 | -{ | ||
35 | - return 0; | ||
36 | -} |
find.h deleted
1 | -#include "find.h" | 1 | +#include "tree.h" |
2 | 2 | ||
3 | int main() | 3 | int main() |
4 | { | 4 | { |
@@ -21,7 +21,6 @@ int main() | @@ -21,7 +21,6 @@ int main() | ||
21 | 21 | ||
22 | wchar_t mot[50]; | 22 | wchar_t mot[50]; |
23 | int taille; | 23 | int taille; |
24 | - taille = 8; | ||
25 | wscanf(L"%ls",mot); | 24 | wscanf(L"%ls",mot); |
26 | wscanf(L"%d",&taille); | 25 | wscanf(L"%d",&taille); |
27 | int result; | 26 | int result; |
@@ -72,7 +72,7 @@ void splitcarac(struct node **tab_ptr_tree,wchar_t message[]) | @@ -72,7 +72,7 @@ void splitcarac(struct node **tab_ptr_tree,wchar_t message[]) | ||
72 | if(message[0]<'a' || message[0]>'z')return; | 72 | if(message[0]<'a' || message[0]>'z')return; |
73 | 73 | ||
74 | wchar_t *buffer; | 74 | wchar_t *buffer; |
75 | - wchar_t *token = wcstok(message, L" ,?;.:/!*+\\\"()=", &buffer); | 75 | + wchar_t *token = wcstok(message, L" ,?;.:/!*+\\\"()=«»", &buffer); |
76 | add(tab_ptr_tree,token,size(token),(int)message[0]-97); | 76 | add(tab_ptr_tree,token,size(token),(int)message[0]-97); |
77 | if(buffer!=NULL)splitcarac(tab_ptr_tree,buffer); | 77 | if(buffer!=NULL)splitcarac(tab_ptr_tree,buffer); |
78 | } | 78 | } |
@@ -116,3 +116,37 @@ void free_dico(struct node **tab_ptr_tree) | @@ -116,3 +116,37 @@ void free_dico(struct node **tab_ptr_tree) | ||
116 | } | 116 | } |
117 | } | 117 | } |
118 | } | 118 | } |
119 | + | ||
120 | +/*Recherche dans le dictionnaire*/ | ||
121 | +int find_mot(struct node **tab_ptr_tree,wchar_t mot[],int size,int fl) | ||
122 | +{ | ||
123 | + if(size==1 && tab_ptr_tree[fl]!=NULL) | ||
124 | + { | ||
125 | + if(tab_ptr_tree[fl]->fin==0)return 1; | ||
126 | + else return 0;//vrais | ||
127 | + } | ||
128 | + if(size==1 && tab_ptr_tree[fl]==NULL)return 1;//faux | ||
129 | + | ||
130 | + struct node *ptr_node = tab_ptr_tree[fl]; | ||
131 | + for(int i=1;i<size;i++) | ||
132 | + { | ||
133 | + if(ptr_node->nbr_fils==0)return 1; | ||
134 | + for(int k=0;k<(ptr_node->nbr_fils);k++) | ||
135 | + { | ||
136 | + if(ptr_node->fils[k]->val==mot[i]) | ||
137 | + { | ||
138 | + ptr_node=ptr_node->fils[k]; | ||
139 | + break; | ||
140 | + } | ||
141 | + else if(k+1==ptr_node->nbr_fils)return 1; | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + if(ptr_node->fin==0)return 1; | ||
146 | + else return 0; | ||
147 | +} | ||
148 | + | ||
149 | +int find() | ||
150 | +{ | ||
151 | + return 0; | ||
152 | +} |
@@ -23,3 +23,7 @@ void load_tree(FILE *, struct node **); | @@ -23,3 +23,7 @@ void load_tree(FILE *, struct node **); | ||
23 | void free_tree(struct node *); | 23 | void free_tree(struct node *); |
24 | 24 | ||
25 | void free_dico(struct node **); | 25 | void free_dico(struct node **); |
26 | + | ||
27 | +int find(); | ||
28 | + | ||
29 | +int find_mot(struct node **,wchar_t*,int,int); | ||
26 | \ No newline at end of file | 30 | \ No newline at end of file |