Pagini recente » Cod sursa (job #281228) | Cod sursa (job #1278535) | Cod sursa (job #2051523) | Rating Poenaru Andrei (andrei.poenaru) | Cod sursa (job #1791623)
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
fstream fin("text.in",ios::in),fout("text.out",ios::out);
char x[1000],*p;
char litere[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPRSTUVWXYZ";
int main()
{
int s=0,nrc=0,n,i;
fin.getline(x,1000);
n=strlen(x);
for(i=0;i<n;i++)
{
if(strchr(litere,x[i])!=0)
{
s++;
}
}
p=strtok(x," -,!?;.");
while(p!=0)
{
nrc++;
p=strtok(0," -,!?;.");
}
fout<<s/nrc;
fin.close();
fout.close();
return 0;
}