Cod sursa(job #2192808)

Utilizator NGMihaiNeamt Mihai NGMihai Data 7 aprilie 2018 13:08:58
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <fstream>
#include <iostream>
#include <string.h>

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

int main()
{
	char cuvant;
	int nrTotalCaractere = 0;
	int nrCuvinte = 0;
	bool cuv = false;

	while (fin.get(cuvant)) {
		if ((cuvant >= 'a' && cuvant <= 'z') || (cuvant >= 'A' && cuvant <= 'Z'))
		{
			nrTotalCaractere++;
			cuv = true;
		}
		else if (cuv == true)
		{
			nrCuvinte++;
			cuv = false;
		}
	}
	if (cuv == true)
		nrCuvinte++;

	fout << nrTotalCaractere / nrCuvinte << "\n";
	return 0;
}