Cod sursa(job #1874694)

Utilizator GabiPTM66Pastrama Cosmin Gabriel GabiPTM66 Data 10 februarie 2017 12:37:46
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <fstream>
#include <strings.h>
#include <iostream>
#include <ctype.h>
using namespace std;

int main()
{
    ifstream f("enunt.in");
    ofstream g("enunt.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++;
            k++;
        }
        else
        {
            if (k!=0)
            {
                x++;
                k=0;
            }
        }

    }
    f.get();
    }

    cout << S/x;
    return 0;
}