Cod sursa(job #640282)
Utilizator | Szasz Tamas Csaba DDeidara | Data | 25 noiembrie 2011 09:44:49 |
---|---|---|---|
Problema | Text | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <cstdio>
int main()
{
char c;
bool t = false;
int word = 0,chr = 0;
FILE*f;
f = fopen("text.in","r");
while (!feof(f))
{
fscanf(f,"%c",&c);
if ( (t) && !( (c>65) && (c<127) ) )
{
chr++;
t = false;
}
if ( (c>65) && (c<127) )
{
word++;
t = true;
}
}
fclose(f);
f=fopen("text.out","w");
fprintf(f,"%d",word/chr);
fclose(f);
return 0;
}