Cod sursa(job #553046)

Utilizator alexdmotocMotoc Alexandru alexdmotoc Data 13 martie 2011 14:56:49
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <fstream>
using namespace std;

char s;
int lit , nrcuv , med , ok;


int main ()
{
	ifstream f ("text.in");
	ofstream g ("text.out");
	
	while (!f.eof())
	{	
		f >> s;
		
		if (s >= 'a' && s <= 'z' || s >= 'A' && s <= 'Z')
		{
			ok = 1;
			lit++;
		}
		
		else 
			if (ok == 1)
			{
				nrcuv++;
				ok = 0;
			}
	}
	
	if (ok == 1)
		nrcuv++;
	
	med = lit/nrcuv;
	
	g << med;
	
	return 0;
}