Pagini recente » Cod sursa (job #616381) | Cod sursa (job #719741) | Cod sursa (job #1879474) | Cod sursa (job #53162) | Cod sursa (job #1247276)
#include <stdio.h>
#include <string.h>
int main()
{
FILE *f = fopen("text.in", "rt");
FILE *g = fopen("text.out", "wt");
char s[1000000], c;
long i, cont = 0, k = 0, nrCaractere = 0;
//fgets(s, 1000000, f);
while (!feof(f))
{
c = fgetc(f);
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{
k = 1;
nrCaractere++;
}
else
{
if (k)
{
k = 0;
cont++;
}
}
}
if (cont)
{
cont = nrCaractere / cont;
}
fprintf(g, "%d", cont);
fclose(f);
fclose(g);
return 0;
}