Cod sursa(job #797198)
| Utilizator | Data | 13 octombrie 2012 16:59:27 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main()
{
int c=0,i=0;
FILE *f,*g;
char s[50], *p;
f=fopen("text.in","r");
g=fopen("text.out","w");
while ( fgets ( s, sizeof(s), f ) != NULL )
{
p=strtok(s," /-?!;',:");
while(p)
{
c++;
i+=strlen(p);
p=strtok(NULL," /-?!;',:");
}
}
/*fprintf(g,"%d\n%d",i,c);
*/
fprintf(g,"%d",i/c);
fclose(f);
fclose(g);
}