Cod sursa(job #1792292)

Utilizator cjalex13Cioarec Alexandru Marian cjalex13 Data 30 octombrie 2016 12:10:34
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <iostream>
#include <fstream>
using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int main()
{
    char x;
    int cuvinte,total;
    cuvinte =0;
    total =0 ;
    int ok=0;
    while(f.get(x)){
        if((x >= 'a' && x<= 'z') || (x>= 'A' && x<= 'Z')){
            total++;
            ok=1;
        }
        else{
            if(ok == 1){
                ok =0 ;
                cuvinte++;
            }
        }
    }
    g<< static_cast<double>(total)/cuvinte ;
    return 0;
}