Cod sursa(job #1151858)

Utilizator pepsiM4A1Ozturk Arif pepsiM4A1 Data 24 martie 2014 13:29:59
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 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('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",c2);
}