Cod sursa(job #393333)

Utilizator AnteusPatrascoiu Mihai Anteus Data 9 februarie 2010 11:35:18
Problema Text Scor 100
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++; 
		if (sw==0)
		{
			nr++;
			sw=1;
		}
	}
	else
		sw=0;
	fscanf (f, "%c", &x);
}
fprintf (g, "%d", k/nr);

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