Pagini recente » Cod sursa (job #196708) | Cod sursa (job #2022224) | Rating mihalcea (bobita) | Cod sursa (job #393993) | Cod sursa (job #2241918)
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
char c;
int wcount = 0, length = 0;
bool separator = false;
ifstream f ("text.in");
ofstream g ("text.out");
while(f.get(c)){
if(('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')){
length ++;
separator = true;
}
else if (separator == true){
wcount ++;
separator = false;
}
}
if(!length)
g<<'0';
else
g<< length/wcount;
f.close();
g.close();
return 0;
}