Cod sursa(job #791778)

Utilizator tudorv96Tudor Varan tudorv96 Data 25 septembrie 2012 12:28:16
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <fstream>

char x;
int cuvinte, litere;
int anterior;

using namespace std;

ifstream fin ("text.in");
ofstream fout ("text.out");

int main ()
{


    while ((x = fin.get()) != EOF)
    {
        if ((x <= 'z' && x >= 'a') || (x >= 'A' && x <= 'Z'))
        {
           anterior = 1;
           litere++;
        }
        else
        {
            if (anterior == 1)
            {
                cuvinte++;
                anterior = 0;
            }
        }
    }
    fout << litere / cuvinte;
    fin.close ();
    fout.close ();
    return 0;
}