Cod sursa(job #1874700)

Utilizator GabiPTM66Pastrama Cosmin Gabriel GabiPTM66 Data 10 februarie 2017 12:42:45
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 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++;
            k++;
        }
        else
        {
            if (k!=0)
            {
                x++;
                k=0;
            }
        }

    }
    f.get();
    }

    g << S/x;
    f.close();
    g.close();
    return 0;
}