Pagini recente » Cod sursa (job #893683) | Cod sursa (job #2284458) | Cod sursa (job #2401328) | Cod sursa (job #2202595) | Cod sursa (job #1823935)
#include<iostream>
#include<cmath>
#include<string>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
bool litera(char c)
{
return (c>='a')&&(c<='z')||(c>='A')&&(c<='Z');
}
void text(string s,int &x, int &y)
{
for (int i=0; i<s.size(); i++)
{
if (litera(s[i])) x++;
if (litera(s[i])&&!litera(s[i+1])) y++;
}
}
main()
{
int x=0,y=0;
string s;
while (!f.eof())
{
getline(f,s);
text(s,x,y);
}
g<<x/y;
}