Cod sursa(job #493726)
Utilizator | Data | 19 octombrie 2010 09:52:18 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<ctype.h>
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char s[256],*p,sep[10]=" ,.;!?";
long long cuv=0,lit=0;
while(f.get(s,255))
{ p=strtok(s,sep);
while(p)
{cuv++;
lit+=strlen(p);
p=strtok(NULL,sep);
}}
g<<lit/cuv;
g.close();
f.close();
}