Cod sursa(job #517160)

Utilizator valentina506Moraru Valentina valentina506 Data 27 decembrie 2010 23:55:18
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include<fstream>
using namespace std;
int lg,nrc,ok;
char s[300],*p,x;
int main()
{
	ifstream f("text.in");
	ofstream g("text.out");
	/*f.getline(s,300);
	p=strtok(s,sep);
	while(p)
	{
		//g<<p<<"\n";
		nrc++;
		lg+=strlen(p);
		p=strtok(NULL,sep);
		
	}*/
	ok=nrc=0;
	while(f.get(x))
	{
		if((x<='z'&&x>='a')||(x<='Z'&&x>='A'))
			{
				lg++;
				ok=1;
			}
		else
			if(ok==1)
			{
				nrc++; 
				ok=0;
			}
	}
			//g<<lg<<" "<<nrc<<"\n";
	g<<lg/nrc;
	return 0;
}