Cod sursa(job #1464434)

Utilizator KusikaPasa Corneliu Kusika Data 23 iulie 2015 15:38:01
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    ifstream f1("text.in");
    ofstream f2("text.out");
    char ch;
    int n=0, cuv=0, k=0;
    while (!f1.eof())
    {
        f1 >> noskipws >> ch;
        if (((ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122)) && k == 1)
            n++;
        if (((ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122)) && k == 0)
        {
            k = 1;
            cuv++;
            n++;
        }
        if (!(ch >= 65 && ch <= 90) && !(ch >= 97 && ch <= 122))
            k = 0;
    }
    f2<<n/cuv;
    f1.close();
    f2.close();
    return 0;
}