Pagini recente » Cod sursa (job #365315) | Cod sursa (job #1382787) | Cod sursa (job #1032341) | Cod sursa (job #2836022) | Cod sursa (job #1251397)
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int nrl,nrc,ok;
char x,y;
int main()
{
nrl = 0;
nrc = 0;
while(f.get(x))
{
if((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z'))
{
nrl++;
ok = 1;
}
if(x == '-' && nrl > 0 && ok == 1)
{
nrc++;
ok = 0;
}
if(x == ' ' && nrl > 0 && ok == 1)
{
nrc++;
ok = 0;
}
if(x == '\n')
nrc++;
}
g<<nrl/nrc;
return 0;
}