Cod sursa(job #2638289)

Utilizator andrei42Oandrei42O andrei42O Data 27 iulie 2020 17:44:04
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char c;
int64_t nr_cuvinte, litere;
bool litera(char);
int main()
{
    while(!f.eof())
    {
        f.get(c);
        if(litera(c))
        {
            nr_cuvinte++;
            while(!f.eof() && litera(c))
            {
                litere++;
                f.get(c);
            }
        }
    }
    g << litere / nr_cuvinte;
    return 0;
}
bool litera(char c)
{
    return (c >= 'a' && c <= 'z')||(c >= 'A' && c <= 'Z');
}