Cod sursa(job #748607)

Utilizator RobertBBadea Corneliu Robert RobertB Data 14 mai 2012 08:43:02
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <iostream>
#include <fstream>
#include <string.h>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int nr_cuv, nr_lit;
bool ok;

char sir[1000],y;

int main()
{
	int i,x;
	while(f.get(y)) {
		if((y <= 'z' && y >= 'a') || (y <= 'Z' && y >= 'A')) {
			nr_lit++;
			if(!ok) {
				nr_cuv++;
				ok = 1;
			}
		} else {
			ok ^= ok;
		}
	}
	g<<nr_lit / nr_cuv;
}