Cod sursa(job #1089620)

Utilizator StranycAlexandru K. Stranyc Data 21 ianuarie 2014 20:07:15
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fi("text.in");
ofstream fo("text.out");
int main()
{
    char c;
    unsigned int suma=0,k=0;
    while(!fi.eof())
    {
        fi>>c;
        if(((c>='a')&&(c<='z')) || ((c>='A')&&(c<='Z')))
        {
            k++;
            while(((c>='a')&&(c<='z')) || ((c>='A')&&(c<='Z')))
            {
             suma++;
             fi>>c;
            }
        }
        
    }
    fo<<suma/k;
    fi.close();
    fo.close();
}