Cod sursa(job #702316)
Utilizator | Data | 1 martie 2012 20:59:14 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<stdio.h>
#include<ctype.h>
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");
int main()
{
char s;
int i,cuv=0,lit=0;
bool ok=1;
while (!feof(f))
{
fscanf(f,"%c",&s);
if (isalpha(s))
{
ok=0;
lit++;}
else if (ok==0)
{
cuv++;
ok=1;
}
}
fprintf(g,"%d",lit/cuv);
return 0;
}