Cod sursa(job #211356)

Utilizator brokensocialiconGrigoriu Cristian-Andrei brokensocialicon Data 1 octombrie 2008 20:45:06
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.78 kb
#include <iostream>
#include <stdio.h>

using namespace std;

int citire()
{
    char buffer;
    int n,cuv=0,lungime=0;
    freopen("text.in","r",stdin);
    while (!feof(stdin))
        {
            scanf("%c",&buffer);
            n=(int)buffer;
            if ((n>=65 && n<=90) || (n>=97 && n<=122))
             lungime++;
            if (n==32)
            {
              cuv++;
              while (&buffer==" " && !feof(stdin))
                scanf("%c",&buffer);
              n=(int)buffer;
              if ((n>=65 && n<=90) || (n>=97 && n<=122))
               lungime++;
            }

        }
        cuv++;
return lungime/cuv;
}

int main()
{
    freopen ("text.out","w",stdout);
    printf ("%d",citire());
    fclose (stdout);
    return 0;
}