Cod sursa(job #1427337)

Utilizator vladandreifabbbyyy vladandrei Data 1 mai 2015 23:03:17
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <iostream>
#include <fstream>
#include <math.h>
#include <string.h>
using namespace std;
ifstream f ("text.in");
ofstream g ("text.out");
int main(){
    char x; int inainteerasimbol = 0, lungime = 0, cuvinte = 0;
    while (f >> noskipws >> x){
        if (!isalpha(x)){
            inainteerasimbol = 1;
        }
        else if (isalpha(x)){
            lungime++;
            if (inainteerasimbol){
                cuvinte++;
                inainteerasimbol = 0;

            }
        }
    }
    if (cuvinte > 0)
        g << lungime/cuvinte;
    else g << "0";
    f.close();
    g.close();

}