Cod sursa(job #1994357)

Utilizator mrpasoteeOprea Alexandru mrpasotee Data 24 iunie 2017 19:36:18
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 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')) && !cuvant)
       {
           cuvinte++;
           cuvant = true;
       }
       else
       {
            cuvant = false;
       }

       toateliterele++;

    }

    fout << cuvinte/toateliterele;

    return 0;
}