Cod sursa(job #1276186)

Utilizator andrei.arnautuAndi Arnautu andrei.arnautu Data 26 noiembrie 2014 00:28:28
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <fstream>
#include <cstring>
using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int litere,nrcuv;
bool ok;
char x;
int main()
{
    while(f.get(x))
    {
        if (ok==false)
        {
            if ((x>='a' && x<='z') || (x>='A'&&x<='Z')) ok = true;
        }
        if(ok==true)
        {
            if ((x>='a' && x<='z') || (x>='A'&&x<='Z')) litere++;
            else
            {
                nrcuv++;
                ok = false;
            }
        }

    }

    g<<litere/nrcuv<<"\n";

    f.close();
    g.close();
    return 0;
}