Cod sursa(job #1222038)

Utilizator cristighrCristi Gherghina cristighr Data 22 august 2014 00:21:31
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");

bool litera(char c)
{
    if((('a'<=c)&&(c<='z'))||(('A'<=c)&&(c<='Z'))) return 1;
    return 0;
}
int main()
{
    char car;
    bool ok=0;
    int nr=0,cuv=0;

    while(f.get(car))
    {
        if(litera(car))
        {
            nr++;
            ok=1;
        }
        else if(ok)
        {
            ok=0;
            cuv++;
        }
    }
   g<<nr/cuv;
}