Cod sursa(job #264168)
Utilizator | Data | 21 februarie 2009 17:14:33 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include<fstream.h>
#include<string.h>
#include<ctype.h>
char s[250],*p;
int i,k1,k2;
void main()
{
ifstream f("text.in");
f.get(s,250);
f.close();
for(i=0;i<strlen(s);i++)
if(!isalpha(s[i]))
s[i]=' ';
for(p=strtok(s," ");p;p=strtok(NULL," "))
{
k1+=strlen(p);
k2++;
}
ofstream fout("text.out");
fout<<k1/k2;
fout.close();
}