Cod sursa(job #97967)
Utilizator | Data | 9 noiembrie 2007 17:40:37 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<iostream.h>
#include<string.h>
#include<stdio.h>
int main()
{
char s[1000],sr[]=" 1234567890-=`~!@#$%^&*()_+;:[]{}'<>,.?/|",*p;
long n=0,k=0,x;
long i=1;
s[0]='1';
FILE *fin,*fout;
fin=fopen("text.in","r");
for (i=1;s[i-1]!=NULL;i++)
fscanf(fin,"%c",&s[i]);
p=strtok(s,sr);
while(p!=NULL){n++;k+=strlen(p);p=strtok(NULL,sr);}
x=k/n-1;
fout=fopen("text.out","w");
fprintf(fout,"%d",x);
fclose(fin);
fclose(fout);
return 0;
}