Cod sursa(job #1098755)

Utilizator BeilandArnoldArnold Beiland BeilandArnold Data 5 februarie 2014 07:55:16
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>
#include <cctype>
using namespace std;

int main(){
    ifstream fin("text.in");
    ofstream fout("text.out");
    unsigned lungtot=0,nrof=0;
    bool sf=true;
    while(!fin.eof()){
        char ch;
        fin.get(ch);
        if(isalpha(ch)){
            lungtot++;
            if(sf){nrof++;sf=false;}
        }
        else sf=true;
    }
    fout<<lungtot/nrof;
    fout.close();
    fin.close();
    return 0;
}