Cod sursa(job #590495)

Utilizator Agent008Cristi Poputea Agent008 Data 17 mai 2011 21:11:36
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 1 kb
#include<iostream.h>
#include<fstream.h>
#include<stdio.h>
#include<string.h>
fstream f("text.in",ios::in), g("text.out",ios::out);
int main()
{
	long contor=2,k=1,sol,ok=0;
	char c;
	if((c>64 && c<91) || (c>96 && c<123))
	{
		k++;
		contor++;
		ok=1;
	}
	while(f.get(c))
	{
		if((c>64 && c<91) || (c>96 && c<123))
		{	k++;ok=1;}
		else
			if(c==32 && ok==1)
			{	contor++;ok=0;}
	}
	sol=k;
	sol=sol/contor;
	g<<sol;
	cout<<contor;
	return 0;
}
/*#include<fstream>
using namespace std;
int main()
{
	char c;
	long long nrcuv=0,nrlit=0,sol;
	bool cuvant=false;
	ifstream fin("text.in");
	fin>>c;
	if((c>64 && c<91) || (c>96 && c<123))
	{
		nrlit++;
		nrcuv++;
		cuvant=true;
	}
	while(fin.get(c))
	{
		if((c>64 && c<91) || (c>96 && c<123))
		{
			nrlit++;
			if(cuvant==false)
			{
				nrcuv++;
				cuvant=true;
			}
		}
		else
			cuvant=false;
	}
	fin.close();
	sol=nrlit;
	sol=sol/nrcuv;
	ofstream fout("text.out");
	fout<<sol<<"\n";
	fout.close();
	return 0;
}*/