Cod sursa(job #260845)

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

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

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

	return 0;
}