Cod sursa(job #807723)

Utilizator Mihnea35Gall Mihnea Mihnea35 Data 5 noiembrie 2012 16:32:41
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream>

using namespace std ;

int validare (char c) {
	return (c>=65 && c<=90) || (c>=97 && c<=122) ;
}

int main ()	{
	int l=0,lc=0,nr=0 ;
	char c ;
	ifstream f ("text.in") ;
	while (f.peek()!=EOF) {
		c=f.get() ;
		if (validare(c)) {
			l++ ;
			lc++ ;
		}
		else {
			if (lc) nr++ ;
			lc=0 ;
		}
	}
	f.close() ;
	ofstream g ("text.out") ;
	g<<l/nr ;
	g.close() ;
return 0 ;
}