Cod sursa(job #1072946)

Utilizator alex.stancuAlex Stancu alex.stancu Data 5 ianuarie 2014 13:44:51
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");

int main()
{
    char c;
    int lit = 0, cuv = 0, ok;
    while(!f.eof())
    {
        f.get(c);
        ok = 0;
        while(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
        {
            ok = 1;
            lit++;
            f.get(c);
        }
        if(ok == 1)
            cuv++;
    }
    f.close();
    g << lit / cuv << '\n';
    g.close();
    return 0;
}