Cod sursa(job #1098687)

Utilizator adi.adnan10Adi Adnan adi.adnan10 Data 5 februarie 2014 00:57:14
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
// text.in.cpp : Defines the entry point for the console application.
//
#include<fstream>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
	char s;
	int sum=0, k=0,cuv=0, i;
	while (fin.get(s))
		if (('a' <= s && s <= 'z') || ('A' <= s && s <= 'Z'))
			k++;
		else 
		{
			if (k)
				cuv++;
			sum += k;
			k = 0;
		}
	
	if (!cuv)fout << 0;
	else fout << sum / cuv;
	return 0;
}