Cod sursa(job #1828542)

Utilizator LeVladzCiuperceanu Vlad LeVladz Data 13 decembrie 2016 15:48:16
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int nrcuv,cuvant,nrlit;
char s;
int EsteLitera(char ch)
{
    if('a'<=ch && ch<='z') return 1;
    if('A'<=ch && ch<='Z') return 1;
    return 0;
}
int main()
{
    while(fin.get(s))
    {
       if(EsteLitera(s))
       {
           nrlit++;
           cuvant=1;
       }
       else
       {
           if(cuvant) nrcuv++;
           cuvant=0;
       }
    }
    fout<<nrlit/nrcuv<<"\n";
    return 0;
}