Cod sursa(job #2130559)

Utilizator claudiurablau16Rablau Claudiu-Ionut claudiurablau16 Data 13 februarie 2018 19:04:53
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

short unsigned int nr_lit=0, nr_cuv=0;
char x;
bool ok=false;

bool verif_ch(char x)
{
    if((x>='a' && x<='z') || (x>='A' && x<='Z')) return 1;
    return 0;
}
int main()
{
    while(fin.get(x))
    {
        if(verif_ch(x)==1)
        {
            nr_lit++;
            if(ok==false)
            {
                nr_cuv++;
                ok=true;
            }
        }
        else ok=false;
    }
    fout<<nr_lit/nr_cuv;
}