Cod sursa(job #1874705)

Utilizator GabiPTM66Pastrama Cosmin Gabriel GabiPTM66 Data 10 februarie 2017 12:44:34
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <fstream>
#include <string.h>
#include <iostream>
#include <ctype.h>

using namespace std;

int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    unsigned int x=0,i,S=0,k=0;
    char s[100];
    while (!f.eof())
    {
        f.get(s,99);
    for (i=0;i<strlen(s);i++)
    {
        if (isalpha(s[i])!=0)
        {
            S++;
            if (k==0)
                x++;
            k++;
        }
        else
        {
            if (k!=0)
            {
                k=0;
            }
        }
    }
    f.get();
    }
    g << S/x;
    f.close();
    g.close();
    return 0;
}