Cod sursa(job #1458003)

Utilizator vav51Andrei vav51 Data 5 iulie 2015 15:39:19
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");

int _tmain(int argc, _TCHAR* argv[])
{
	
	char x;
	int nr_cuvinte = 0, nr_caractere = 0;
	while (f >> noskipws >> x){
		if (isalpha(x) && !isdigit(x)){
			nr_caractere++;
		}
		else{
			if (nr_caractere > 0)
			nr_cuvinte++;
		}
	}
	nr_cuvinte--;
	if (nr_cuvinte) g << nr_caractere / nr_cuvinte;
	f.close();
	g.close();
	return 0;
}