Cod sursa(job #245269)

Utilizator f.v.antonFlavius Anton f.v.anton Data 17 ianuarie 2009 15:21:52
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream.h>
#include <fstream.h>


int main()
{
	long nrcuv=0,len=0;
	char ch='a',k=0;
	fstream f("text.in",ios::in), g("text.out",ios::out);
	while(!f.eof())
	{       f.get(ch);

		if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
		 {	k=1;  len++; }
		else
		if(k==1)
		{
			k=0;
			nrcuv++;
		}
	}
	cout<<len<<" "<<nrcuv;
	g<<len/nrcuv;
	g.close();
	f.close();
	return 0;
}