Cod sursa(job #155180)
| Utilizator | Data | 11 martie 2008 19:41:41 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<stdio.h>
char c;
int cuv=0,l=0;
int main()
{
FILE *f=fopen("text.in","r");
int ok=1;
while(!feof(f)&&ok)
{
if(fscanf(f,"%c",&c)<=0)break;
if(c>=65&&c<=90||c>=97&&c<=122)
{cuv++;
while(c>=65&&c<=90||c>=97&&c<=122)
{l++;
if(fscanf(f,"%c",&c)<=0){ok=0;break;}
}
}
}
fclose(f);
FILE *g=fopen("text.out","w");
fprintf(g,"%d",l/cuv);
fclose(g);
return 0;
}
