Cod sursa(job #2072378)

Utilizator TheSlorrow44Tudose George Stefan TheSlorrow44 Data 21 noiembrie 2017 19:55:35
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    ifstream in("text.in");
    ofstream out("text.out");
    char a;
    int numarCuvinte=0, LungimeSir=0, OK;
    while(in.get(a))
    {
        if((a>='a' && a<='z') || (a>='A' && a<='Z'))
        {
            LungimeSir ++;
            OK=1;
        }
        else {
            if(OK)
            {
                numarCuvinte++; OK=0;
            }
        }
    }
    if(numarCuvinte==0){out<<0;}
    out<<LungimeSir/numarCuvinte;
    in.close();
    out.close();
}