Cod sursa(job #488897)

Utilizator myshuSpatariu Mihai-Constantin myshu Data 30 septembrie 2010 15:47:00
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include<fstream.h>
#include<stdio.h>
int main ()
{
	ofstream fcout("text.out");
	FILE *f=fopen("text.in","r");
	int l2,lungime,cuv=0,i;
	char x='q';
	lungime=0;l2=lungime;
	while(x!='\n')
		{fscanf(f,"%c",&x);
		if((x<='z'&&x>='a')||(x<='Z'&&x>='A'))lungime++;
		else if(l2!=lungime){cuv++;l2=lungime;}}
	if(cuv!=0)fcout<<lungime/cuv;
		else fcout<<0;
	fcout<<'\n';
	return 0;
}