Pagini recente » Cod sursa (job #1594) | Cod sursa (job #3157931) | Cod sursa (job #2858265) | Cod sursa (job #1442985) | 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;
}