Cod sursa(job #1979623)

Utilizator VarticeanNicolae Varticean Varticean Data 10 mai 2017 22:26:09
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <iostream>
#include <fstream>

using namespace std;
char c;

bool control(){
if ((c >= 48 && c <= 57 ) || ( c>=65 && c<=90 ) || ( c>=97 && c<=122) )
    return true;
else return false;
}

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

 long litere=0, cuvinte=0, cuvinte01=0;
while( in.get(c) ){
     if( control() ) {
               litere++; if( cuvinte01>0 ) { cuvinte++; cuvinte01=0;}
           }
     else if( c==' ' || c=='-') cuvinte01++;

}

out<<litere/cuvinte;

    return 0;
}