Cod sursa(job #497684)

Utilizator uniquePacurar Alexandru unique Data 3 noiembrie 2010 01:56:52
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <stdio.h>

int main()
{
	char c, c2 = -1;
	long int x;
	long int k1 = 0, k2 = 0;
	FILE *in,*out;
	in = fopen("text.in","r");
	do
	{
		fscanf (in,"%c", &c);
		if(c2 != -1 && (((c2 >= 0 && c2 <= 64) || (c2 >= 91 && c2 <= 96)) || (c2 >= 123)) && ((c >= 65 && c <= 90) || (c >= 97 && c <= 122))) k2++;
		if((c >= 65 && c <= 90) || (c >= 97 && c <= 122)) k1++;
		c2 = c;
	}while(!feof(in));
	fclose(in);
	out = fopen("text.out","w");
	long int result = k1/k2;
	fprintf(out,"%ld",result);
	fclose(out);
	return 0;
}