Bonjour,

Je fais un appel à l'aide à toutes personne ayant des connaissances dans la programmation en DVC++, je dois réalisé dans le cadre d'un projet scolaire un programme permettant l'étude de textes. Je souhaiterais avoir d'afficher le nombre de mot, puis après que chaque mot soit affiché avec son nombre de répétition.
En espérant, avoir un retour je vous souhaite une bonne soirée.
Cordialement.

Voici le début de mon programme, je bloque sur l'affichage des mots et du nombre de répétition.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
 
int main()
{
char str[10000],c='a';
 
int imot=0,jlettre=0, count=0;
FILE *fp;
 
fp=fopen("hauts.txt","r");
 
/* printf("Entrer une chaine de caractere: ");
gets(str);*/
 
while (!feof(fp)){
 
c=fgetc(fp);
if(c== ' ' || c== '\t' || c== '\n') count++;
else printf("%c",c);
 
}
printf("\n il y a %d mots\n",count);
 
char tabmots[count][30];
printf("%d\n",sizeof(tabmots));
fp=freopen("hauts.txt","r",fp);
 
while (!feof(fp)){
c=fgetc(fp);
if((c<65) || (c>90) || (c<97) || (c>122)) {
//printf("%s\n",tabmots[imot]);
imot++;
jlettre=0;
}
else {
tabmots[imot][jlettre++]=c;
printf("%d \t %c ",c,c);
} 
}
 
/* for(i = 0; str[i] != '\0'; i++) //compter nombre total mot dans le texte
{
if(str[i] == ' ' || str[i] == '\t' || str[i] == '\n')
{
count++; 
} 
} 
printf("il y a %d mots\n",count);*/
fclose(fp);
 
/* int tableau_mot[count], tableau_nombre_utilisation[count];
 
for (...)
{
if (mot existe pas encore)
{
ajoute au tableau
ajoute +1 a tableau_nombre_utilisation
}
else (mot existe deja)
{
cherche dans le tableau ou est le mot
recuperer le numero de la case
fait +1 dans l'autre tableau (tableau_nombre_utilisation) au bon numero de case
}
}
 
for (i=0; i<count; i++)
{
printf("\nle mot %c est apparu %d fois", tableau_mot[i], tableau_nombre_utilisation[i]); //affchage resultat (nombre de mot different total)
}*/
 
return 0;
}

voici le texte choisi ( en anglais pour éviter de compliquer la tâche avec les accents)


I have just returned from a visit to my landlord - the solitary neighbour that I shall be troubled with. This is certainly a beautiful country! In all England, I do not believe that I could have fixed on a situation socompletely removed from the stir of society. A perfect misanthropist's heaven: and Mr. Heathcliff and I aresuch a suitable pair to divide the desolation between us. A capital fellow! He little imagined how my heartwarmed towards him when I beheld his black eyes withdraw so suspiciously under their brows, as I rode up,and when his fingers sheltered themselves, with a jealous resolution, still further in his waistcoat, as I announced my name.