Cod sursa(job #569517)

Utilizator Adrian1997Radulescu Adrian Adrian1997 Data 1 aprilie 2011 17:10:28
Problema Text Scor 70
Compilator cpp Status done
Runda 104 Marime 0.47 kb
#include <stdio.h>
#include <string.h>
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");

int main(void){
	register int i;
	
	char ch;
	bool ok;
	int nrl=0,nrc=0;
	while(!feof(f)){
		fscanf(f,"%c",&ch);
		int cod=ch;
		if((cod>=65 && cod<=90) || (cod>=97 && cod<=122)){
			if(!ok){
				ok=true;
				nrc++;
			}	
			nrl++;
		}	
		else if(cod<65 || (cod>90 && cod<97) || cod>122){
			ok=false;
		}
		
	}
	
	fprintf(g,"%d",nrl/nrc);
	return 0;
}