Cod sursa(job #1034749)

Utilizator leontinLeontin leontin Data 18 noiembrie 2013 01:08:09
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 kb
#include <iostream>
#include <stdio.h>
#include <string.h>


using namespace std;

int main()

{


FILE *f,*g;

    f=fopen("text.in","r");
    g=fopen("text.out","w");

    char c;
    long long nrc=0,nrl=0,ok=0;
    while(!feof(f))
    {
         fscanf(f,"%c",&c);
        if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
        {
            nrl++;
            if(ok==0)
            {

            nrc++;
            ok=1;
            }
        }
        else
        {


           ok=0;
        }


    }


   fprintf(g,"%lld",nrl/nrc);
    fclose(f);
    fclose(g);
    return 0;

}