Cod sursa(job #593681)

Utilizator Zangetsu2201Stefan Paul Slujbe Zangetsu2201 Data 4 iunie 2011 11:17:40
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <cstdio>

int main()
{
	FILE *in=fopen("text.in", "r"), *out=fopen("text.out", "w");
	char aux;
	int cuvinte=0, total=0;
	while ((aux=fgetc(in))!=EOF)
	{
		if (aux>=65 && aux<=90 || aux>=97 && aux<=122)
		{
			cuvinte++;
			while (aux>=65 && aux<=90 || aux>=97 && aux<=122)
			{
				total++;
				aux=fgetc(in);
			}
		}
	}
	fprintf(out, "%d", total/cuvinte);
}