Cod sursa(job #27078)
Utilizator | Fodor Stefan xtephan | Data | 6 martie 2007 07:46:16 |
---|---|---|---|
Problema | Text | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include<stdio.h>
#include<string.h>
int main()
{
char s[255];
char *p;
int r, cuv=0,lit=0;
FILE *f=fopen("text.in", "r");
FILE *g=fopen("text.out", "w");
if(f==NULL) printf("fiserul tarane!!");
else
{
while(!feof(f))
{
fgets(s, 255, f);
p=strtok(s,"` 1234567890-=~!@#$%^&*()_+|[];',./{}:<>?\t");
while(p)
{
cuv++;
lit+=strlen(p);
p=strtok(NULL, "` 1234567890-=~!@#$%^&*()_+|[];',./{}:<>?\t");
}
}
}
r=lit/cuv;
fprintf(g, "%d", r);
fcloseall();
return 0;
}