Pagini recente » Cod sursa (job #1400131) | Cod sursa (job #855623) | Clasamentul arhivei de probleme | Cod sursa (job #232522) | Cod sursa (job #264173)
Cod sursa(job #264173)
#include<fstream.h>
#include<string.h>
#include<ctype.h>
char s[250],*p;
int i,k1,k2;
int 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<<(int)k1/k2;
fout.close();
return 0;
}