Cod sursa(job #1151878)

Utilizator pepsiM4A1Ozturk Arif pepsiM4A1 Data 24 martie 2014 13:37:14
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <stdio.h>
using namespace std;
int main()
{
    FILE *fin,*fout;
    fin=fopen("text.in","r");
    fout=fopen("text.out","w");
    char ch;
    int c1=0,c2=0;
    bool as=0;
    while(!feof(fin))
    {
        fscanf(fin,"%c",&ch);
        if(feof(fin)) break;
        if('a'<=ch&&'z'>=ch) {as=1; c1++;}
        else if('A'<=ch&&'Z'>=ch) {as=1; c1++;}
        else if(ch==' '||ch=='!'||ch=='?'||ch=='.') if(as==1) {c2++;}
    }
    fprintf(fout,"%i",c1/c2);
}