Cod sursa(job #1742043)

Utilizator jurjstyleJurj Andrei jurjstyle Data 15 august 2016 18:38:40
Problema Text Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <fstream>

using namespace std ;

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

int nr_cuv , nr_litere , litere_curente ;

int main ()
{
 char ch ;
 f.get ( ch ) ;
 while ( f.get ( ch ) )
    {
     if ( ( ch >= 'a' && ch <= 'z' ) || ( ch >= 'A' && ch <= 'Z' ) )
        {
         ++nr_litere ;
         ++litere_curente ;
         if ( litere_curente == 1 )
            ++nr_cuv ;
        }
     else
        litere_curente = 0 ;
    }
 g << nr_litere /  nr_cuv ;

}