Cod sursa(job #1994361)

Utilizator mrpasoteeOprea Alexandru mrpasotee Data 24 iunie 2017 19:47:52
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <iostream>
#include<fstream>

using namespace std;

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

    char litera;

    int cuvinte = 0;
    int toateliterele = 0;

    bool cuvant = false;

    while(fin)
    {
        fin.get(litera);

        if( (litera>='a' && litera<='z') || (litera>='A' && litera<='Z') )
        {
            if(!cuvant)
            {
                cuvinte ++;
                cuvant = true;
            }

           toateliterele++;
        }
        else
        {
            cuvant = false;
        }
    }

    fout << cuvinte/toateliterele;

    return 0;
}