Cod sursa(job #996717)

Utilizator s1mpMihai Alexandru s1mp Data 12 septembrie 2013 15:45:13
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;

int main()
{
	ifstream f("text.in");
	ofstream g("text.out");
	char s;
	// l = Numarul de litere;
	// nr = Numarul de cuvinte;
	int l=0,nr=0,a=0;
	while (!f.eof())
		{
			f.get(s);
			if ((s>='a' && s<='z') || (s>='A' && s<='Z')) {
															if (a==0) 
															{a++;nr++;}
															l++;
															}
				else a=0;
		}
	g<<l/nr;
	f.close();
	g.close();
	return 0;
}