Cod sursa(job #260834)

Utilizator ooctavTuchila Octavian ooctav Data 17 februarie 2009 16:22:20
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
// Text.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <stdlib.h>
char e[2000004];
int main()
{
	int n,i,c=0,d=0;
	bool s=false,a;
	FILE *f1,*f2;
	f1=fopen("text.in","r");
	f2=fopen("text.out","w");
	fgets(e,2000003,f1);
	for(i=1;i<=2000003;i++)
	{
		a=s;
		s=false;
		if(e[i]<=90)
			if(e[i]>=65)
			{
				c++;
				s=true;
			}
		if(e[i]>=97)
			if(e[i]<=122)
			{
				c++;
				s=true;
			}
		if(s==false && a==true)
			d++;
		if(e[i]=='EOF')
			break;

	}
	fprintf(f2,"%d",c/d);
	fclose(f1);
	fclose(f2);

	return 0;
}