Cod sursa(job #2343865)

Utilizator albucristianAlbu Cristian-Gabriel albucristian Data 14 februarie 2019 13:50:46
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <stdio.h>
using namespace std;
FILE *f,*g;
int main()
{
    int c1,c2;
    char c,cc=0;
    f=fopen("text.in","r");
    g=fopen("text.out","w");
    c1=c2=0;
    while(c!='\n')
    {
        fscanf(f,"%c",&c);
        if(c>='a'&&c<='z'||c>='A'&&c<='Z')
        {
            c1++;
        }
        else
        {
            if(cc>='a'&&cc<='z'||cc>='A'&&cc<='Z')
                c2++;
        }
        cc=c;
    }
    c1/=c2;
    fprintf(g,"%d",c1);
    return 0;
}