Pagini recente » Cod sursa (job #3133149) | Cod sursa (job #293974) | Cod sursa (job #346059) | Cod sursa (job #2957949) | Cod sursa (job #1458003)
// 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;
}