Cod sursa(job #595314)

Utilizator AllenSmailovic Alen Allen Data 11 iunie 2011 20:58:19
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include<stdio.h>

using namespace std;

int main()
{
    char c;
    int ok=0,litere=0,cuvinte=0;
    FILE *fin, *fout;
    fin = fopen("text.in", "rt");
    fout = fopen("text.out", "wt");

    while(c=fgetc(fin))
    {
        if((c>='a' && c<='z') || (c>='A' && c<='Z'))
        {
            litere++;
            if(!ok)
            {
                cuvinte++;
                ok=1;
            }
        }
        else
        {
            ok = 0;
            if(c == EOF) break;
        }
    }
    fprintf(fout, "%i",litere/cuvinte);
    return 0;
}