Pagini recente » Cod sursa (job #3350534) | Cod sursa (job #3341707) | Cod sursa (job #2121045) | Cod sursa (job #2437046) | Cod sursa (job #2071399)
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int nr=0;
int lg=0;
char x[50];
bool litera(char c)
{
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
return true;
return false;
}
int main()
{
while(f >> x)
{
for (int i = 0 ; i <= strlen(x); i ++ )
if (litera(x[i])==true)
lg++;
nr++;
}
if (nr>0)
g << lg / nr;
else
g << "0" ;
return 0;
}