Cod sursa(job #97945)

Utilizator emy2704S Octav emy2704 Data 9 noiembrie 2007 17:08:17
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[1000000000],sr[]=" 1234567890-=`~!@#$%^&*()_+;:[]{}'<>,.?/|",*p;
int n=0,k=0,x;
long i=1;
s[0]='1';
FILE *fin,*fout;
fin=fopen("text.in","r");
while(s[i-1]!=NULL)
{fscanf(fin,"%c",&s[i]);i++;}
p=strtok(s,sr);
while(p!=NULL){n++;k+=strlen(p);p=strtok(NULL,sr);}
x=k/n;
fout=fopen("text.out","w");
fprintf(fout,"%d",x);
fclose(fin);
fclose(fout);
return 0;
}