Cod sursa(job #988416)

Utilizator lucianzr1Boaca Lucian lucianzr1 Data 22 august 2013 19:48:20
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    fstream dataFile;
    dataFile.open("text.in", ios::in);

    fstream outputFile;
    outputFile.open("text.out", ios::out);

    int cuv=0, lit=0, ok=0;
    char ch;

    while(!dataFile.eof())
    {
        dataFile.get(ch);
        if(!isalpha(ch) && ok==1)
        {
            cuv++; ok=0;
        }
        else if(isalpha(ch))
        {
            lit++; ok=1;
        }
    }
    outputFile<<lit/cuv;
    return 0;
}