Cod sursa(job #393329)

Utilizator AnteusPatrascoiu Mihai Anteus Data 9 februarie 2010 11:30:48
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <stdio.h>
#include <ctype.h>
FILE *f=fopen ("text.in", "r");
FILE *g=fopen ("text.out", "w");
char x;
int k,nr,i,sw;

int main() {
fscanf (f, "%c", &x);
while (!feof(f))
{
	if (isalpha (x))
		{ k++; sw=1; }
	else
		if (sw)
			{ nr++; sw=0; }
	fscanf (f, "%c", &x);
}
if (nr==0)
	nr=1;
fprintf (g, "%d", k/nr);

fclose(f);
fclose(g);
return 0;
}