Cod sursa(job #710664)

Utilizator simpleBereczki Cristian simple Data 10 martie 2012 15:59:54
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include<stdio.h>
#include<string.h>
#include<ctype.h>
FILE *f=fopen("text.in","r"),*g=fopen("text.out","w");
int main()
{char c;
long nc,lt,ok=0;;
lt=0;nc=0;
while(!feof(f))
	{fscanf(f,"%c",&c);
	if(isalpha(c))
		{ok=1;lt++;
		}
	else
		{if(ok==1)
			{ok=0;nc++;
			}
		}
	}
fprintf(g,"%ld",lt/nc);
fclose(f);
fclose(g);
return 0;
}