Mai intai trebuie sa te autentifici.

Cod sursa(job #713091)

Utilizator iarbaCrestez Paul iarba Data 14 martie 2012 11:00:51
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <stdio.h>
long s,q,m;
char a;
FILE *f,*g;
int conditie()
{
	int r=0;
	if((a>='a')&&(a<='z')){r=1;}
	if((a>='A')&&(a<='Z')){r=1;}
return r;
}

void cauta()
{
	long t=0;
	while(conditie()){q=fscanf(f,"%c",&a);t++;m++;}
	if(t){s++;}
}

int main()
{
	f=fopen("text.in","r");
	g=fopen("text.out","w");
	a='z';s=0;q=1;m=0;
	while(q+1){
		q=fscanf(f,"%c",&a);
		cauta();
	        }
	fprintf(g,"%ld",m/s);
fclose(f);fclose(g);
return 0;
}