Cod sursa(job #163390)
| Utilizator | Data | 22 martie 2008 09:12:45 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include<stdio.h>
char c;
long int cuv,litere,cuvinte,sol;
int main()
{
FILE *f=fopen("text.in","rb");
while(fscanf(f,"%c",&c)!=EOF)
{ if((('a'<=c)&&('z'>=c))||(('A'<=c)&&('Z'>=c)))
{ litere++;
if(!cuv)cuv=1;
}
else
{cuvinte+=cuv;cuv=0;}
}
cuvinte+=cuv;
fclose(f);
f=fopen("text.out","w");
sol=litere/cuvinte;
fprintf(f,"%ld\n",sol);
fclose(f);
return 0;
}
