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
| #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int motValable (char *mot)
{
int i,j=strlen(mot);
for (i=0;i<j;i++)
{
if (mot[i]<'a' && mot[i]>'z')
{
return 0;
}
}
return 1;
}
int main()
{
FILE *f,*six,*sept,*huit,*neuf,*dix;
char t[20];
f=fopen("dic.txt","r");
six=fopen("6.txt","w");
sept=fopen("7.txt","w");
huit=fopen("8.txt","w");
neuf=fopen("9.txt","w");
dix=fopen("10.txt","w");
fseek(f,0,SEEK_SET);
while (!feof(f))
{
fscanf(f,"%s \n",t);
if (motValable(t)){
if (strlen(t)==6)
{
fprintf(six,"%s ",t);
}
else if (strlen(t)==7)
{
fprintf(sept,"%s \n",t);
}
else if (strlen(t)==8)
{
fprintf(huit,"%s \n",t);
}
else if (strlen(t)==9)
{
fprintf(neuf,"%s \n",t);
}
else if (strlen(t)==10)
{
fprintf(dix,"%s \n",t);
} }
}
fclose (f);
fclose (six);
fclose (sept);
fclose (huit);
fclose (neuf);
fclose (dix);
return 0;
} |
Partager