Cod sursa(job #1248536)

Utilizator Aronn00Vladutu Georgian Aronn00 Data 25 octombrie 2014 14:23:20
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include<iostream>
#include<fstream>
using namespace std;
int main(){
	ifstream f("text.in");
	ofstream g("text.out");
	char a,b;
	int count = 0, word = 0;
	a = f.get();
	if (a >= 'a' && a <= 'z' || a >= 'A' && a <= 'Z')
		count++;

	while (!f.eof()){
		b = f.get();
		if (b >= 'a' && b <= 'z' || b >= 'A' && b <= 'Z')
			count++;
		if ((b >= 'a' && b <= 'z' || b >= 'A' && b <= 'Z') && !(a >= 'a' && a <= 'z' || a >= 'A' && a <= 'Z'))
			word++;
		a = b;
	}

	g<<(int)(count/word);


	return 0;
}