Cod sursa(job #1061365)

Utilizator Balescu_OvidiuBalescu Ovidiu-Gheorghe Balescu_Ovidiu Data 19 decembrie 2013 17:19:55
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.73 kb
#include<stdio.h>
#include<stdlib.h>
using namespace std;
char c; int q,cuv,flag,m,F=1;
int main()
{
    FILE*f=fopen("text.in","r"); FILE*h=fopen("text.out","w");
    while(!feof(f))
    {
        fscanf(f,"%c",&c);
        if(!feof(f))
        {
            if((F==1)&&((c>64)&&(c<91)))
            {
                cuv++;
                F=0;
            }
            if((c>96&&c<123)||(c<91&&64<c))
            {
                q++;
                flag=1;
            }
            else
            if((c==32||c==45||c==0)&&flag==1)
            {
               cuv++;
               flag=0;
            }
        }

    }
    m=cuv/q;
    fprintf(h,"%i",m);
    fclose(f); fclose(h);
    return 0;
}