Pagini recente » Cod sursa (job #1451282) | Cod sursa (job #2842520) | Cod sursa (job #2579129) | Cod sursa (job #684546) | Cod sursa (job #1873072)
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
char p;
int nr_cuvinte = 0, lungime = 0;
ifstream fin("text.in");
ofstream fout("text.out");
while ( fin>>noskipws>>p)
{
if ((p >= 'A' && p <= 'Z') || (p >= 'a' && p <= 'z'))
lungime++;
if (p == ' ' || p==' \n' || p=='\n')
nr_cuvinte++;
}
fout << lungime / (nr_cuvinte + 1);
fin.close();
fout.close();
}