Cod sursa(job #570941)

Utilizator alexamiu2008Miu Alexandra alexamiu2008 Data 3 aprilie 2011 19:41:25
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb

#include<stdio.h>
FILE*fin,*fout;
int i,nrcuv,nrl,ok;
char ch;
int main(){
fin=fopen("text.in","r");
fout=fopen("text.out","w");
//fscanf(fin,"%c",&ch);
ok=0;
while(fscanf(fin,"%c",&ch)!=EOF){
if(ch<'a'){ch=ch+32;   }
if(ch<='z'&&ch>='a'&&ok==0){ok=1;nrcuv++;nrl++;}
else if(ch<='z'&&ch>='a'&&ok==1){nrl++;}
else{ok=0;}
fscanf(fin,"%c",&ch);
//if(ch==feof(fin)||ch=='\n'){break;}
}
fprintf(fout,"%d",nrl/nrcuv);
return 0;
}