Cod sursa(job #2221541)

Utilizator beatrice01Ferco Beatrice beatrice01 Data 14 iulie 2018 18:27:17
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <fstream>
#include <iostream>

using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");

int cuv = 0, lungime = 0;

int main()
{
	char c;
	bool eLitera = false;
	while (fin.get(c)) {
		if ('a'<=c && 'z'>=c || 'A'<=c && 'Z'>=c) {
			lungime++;
			eLitera = true;
		}
		else
		{
			if (eLitera == true)
			{
				cuv++;
			}
			eLitera = false;
		}
	}
	//cout <<"\n" <<lungime << " " << cuv << "\n";
	if (cuv == 0) fout << "0";
	else
		fout << lungime / cuv;

	//system("pause");
	return 0;
}