Cod sursa(job #1207620)

Utilizator cojocarugabiReality cojocarugabi Data 13 iulie 2014 14:48:31
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>

using namespace std;

char c,o;
long long a=0,b=0;

bool corespunde(char c)
{
   int x=c;
   if ((65<=x && x<=90)||(97<=x && x<=122))
        return true;
   return false;
}
int main()
{
    ifstream fi("text.in");
    ofstream fo("text.out");
    fi.get(o);
    if (corespunde(o))
    {
        a++;
        b++;
    }
    while (! fi.eof())
    {
        fi.get(c);
        if (corespunde(c))
            ++a;
        if (corespunde(c) && !corespunde(o))
            ++b;
        o=c;
    }
    fo<<a/b;
}