Cod sursa(job #268060)

Utilizator robertzelXXX XXX robertzel Data 28 februarie 2009 18:26:53
Problema Text Scor 90
Compilator c Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <stdio.h>

char x;
int l, s, c;

void citeste ()
{
	FILE * in = fopen("text.in", "r");

	while (!feof(in))
	{
		if (!feof(in))
		{
			fscanf(in, "%c", &x);

			if (((x >= 'a') && (x<='z')) || ((x >= 'A') && (x<='Z')))
			{

				l++;
			}
			else if (l != 0)
			{
				s+=l;
				l=0;
				c++;
			}
		}
	}

	fclose(in);
}

void scrie ()
{
	FILE * out = fopen("text.out", "w");


	fprintf(out, "%d", (s/c));

	fclose(out);
}

int main ()
{
	citeste();
	scrie();

	return 0;
}