Pagini recente » Cod sursa (job #2846284) | Cod sursa (job #1426952) | Cod sursa (job #3301323) | Cod sursa (job #799148) | Cod sursa (job #712962)
Cod sursa(job #712962)
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
char s[256];
int ascii=0,sw=0;
long n_ch=0,n_word=0;
ifstream fcin("text.in");
ofstream fcout("text.out");
while(!fcin.eof())
{
fcin.getline(s,256,'\n');
sw=1;
for(int i=1;i<=strlen(s);i++)
{
ascii=(int) s[i];
if (((ascii>=65)&&(ascii<=90))||((ascii>=97)&&(ascii<=122)))
{
n_ch++;
sw=0;
}
else
if (sw==0)
{
sw=1;
n_word++;
}
}
}
fcout<<n_ch/n_word;
fcin.close();
fcout.close();
}