Cod sursa(job #1250901)

Utilizator aquarisAdrian Ghita aquaris Data 28 octombrie 2014 18:38:01
Problema Text Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{
	ifstream f ("text.in");
	ofstream g ("text.out");

	char c;
	int nrcuv = 0, nrlit = 0;
	bool ok = 0;

	f.get(c);

	while ((c < 'A') || ((c > 'Z') && (c < 'a')) || (c >'z'))
		f.get(c);

	while (f.get(c))
	{
		cout << c;
		if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')))
		{	
			nrlit++;
			ok = 1;
		}
		else
		{
			if (ok == 1)
				nrcuv++;
			ok = 0;
		}
	}

	if (ok == 1)
		nrcuv++;

	g << nrlit / nrcuv;

	return 0;
}