Cod sursa(job #1730366)

Utilizator Tudor_CandeaCandea Tudor Tudor_Candea Data 16 iulie 2016 20:35:19
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.87 kb
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");

char a;

int main()
{
    int ctcuv=0, ctlit=0;
    bool b=false;
    while(fin.get(a))
    {
        if(a<='z' and a>='a')
        {
            ctlit++;
            b=true;
        }
        if((a>=' ' and a<='@') and b==true)
        {
            ctcuv++;
            b=false;
        }
        if((a>='[' and a<='`') and b==true)
        {
            ctcuv++;
            b=false;
        }
        if((a>='{' and a<='~') and b==true)
        {
            ctcuv++;
            b=false;
        }
        if(a<='Z' and a>='A')
        {
            ctlit++;
            b=true;
        }
    }
    if(a=='\n' and b==true)
        ctcuv++;

   // fout<<ctlit<<' '<<ctcuv<<'\n';
    fout<<abs(ctlit/ctcuv);
    return 0;
}