Cod sursa(job #268070)

Utilizator robertzelXXX XXX robertzel Data 28 februarie 2009 19:03:20
Problema Text Scor 90
Compilator c Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <stdio.h>
#include <ctype.h>

char x;
int s, c, ok;

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

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


		if (isalpha(x))
		{
			s++;
			ok=1;
		}
		else if (ok==1)
		{
			ok=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;
}