Cod sursa(job #2161)
Utilizator | Data | 16 decembrie 2006 09:50:12 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<fstream.h>
#include<math.h>
int i,nrc,nrl,n;
char s[1000000],*p,sep[]=" ,.!?-:;";
int main()
{
ifstream f("text.in");
ofstream g("text.out");
f.getline(s,1000000);
p=strtok(s,sep);
while(p)
{
nrl+=strlen(p);
nrc++;
p=strtok(NULL,sep);
}
g<<floor(nrl/nrc);
return 0;
}