Cod sursa(job #668081)
Utilizator | Data | 24 ianuarie 2012 12:27:26 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<cstdio>
#include<string>
int main()
{FILE*f=fopen("text.in","r");
FILE*g=fopen("text.out","w");
char s[1000],*p;
int nr=0,x,suma=0;
fgets(s,1000,f);
p=strtok(s,"., -");
while(p!=NULL){
nr++;
suma=suma+strlen(p);
p=strtok(NULL," -");
}
x=suma/nr;
fprintf(g,"%d",x);
}