Pagini recente » Cod sursa (job #181969) | Cod sursa (job #1135417) | Cod sursa (job #2633594) | Cod sursa (job #2337513) | Cod sursa (job #2703221)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int main()
{
char c;
int nr=0, lungime=0, nrcuvinte=0;
while(fin.get(c)){
if(isalpha(c)){
nr++;
}
else{
if(nr>0){
lungime+=nr;
nrcuvinte++;
}
nr=0;
}
}
if(nr>0){
lungime+=nr;
nrcuvinte++;
}
if(nrcuvinte!=0)fout<<lungime/nrcuvinte;
else fout<<0;
return 0;
}