tree.c
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define size 50
#define taille 26
struct noeud { char valeur; struct noeud * fils[28]; int complet;};
struct dico {struct noeud* tableau[26];};
typedef struct noeud* Noeud;
void cons_noeud (Noeud * pN, char a)
{
*pN = malloc(sizeof(struct noeud));
(*pN)->valeur=a;
(*pN)->complet=0;
for(int i=0; i<28; i++)
{
(*pN)->fils[i]=NULL;
}
}
void ajout_noeud_dico(struct dico * D, Noeud N)
{
int i=0;
while(D->tableau[i]!=NULL)
{i++;}
D->tableau[i]=N;
}
void ajout_mot(Noeud * pN, char mot[size])
{
if(*pN==NULL)
{
cons_noeud(pN,mot[0]);
sup_lettre(mot);
}
else
}
char * sup_lettre(char mot[size])
{
for(int i=1; i<size; i++)
{
mot[i]= mot[i+1];
}
printf("%s\n",mot);
}
//Reprendre cette fonction!
/*void cons_dico_file(FILE* fp, struct dico* D)
{ char mot[size];
if(fp==NULL)
return;
while(fscanf(fp,"%s",a)==1)
{ ajout_mot(D,a);
//D->dernier++;}
}*/
/*int rech_mot(struct dico D,char mot [size])
{
Noeud N;
int nbre;
for(int i=0;i<D.dernier;i++)
{
if(D.tableau[i].valeur==mot[0])
{
N=D.tableau[i];
for(int j=0;j<size;j++)
{
if(N.valeur==mot[j])
N=*(N.fils)->noeud;
else
nbre=0;
}
if(N.complet==1)return newmot
nbre=1;
}
else
nbre= 0;
}
return nbre;
}*/
/*void correction_texte(char filename[size], struct dico D)
{
FILE *fp=fopen(filename, "r");
char mot[size];
int x;
if(fp==NULL)return newmot
return;
else
{
while(fscanf(fp,"%s",mot)==1)
{
x=rech_mot(D,mot);
if(x==0)
{
printf("il y a une erreur!\n");
printf("%s",mot);
}
}
}
}*/
int main()
{
char* newmot;
sup_lettre("emilie");
return 0;
}