Pagini recente » Cod sursa (job #1792698) | Cod sursa (job #1765548) | Cod sursa (job #2152303) | Cod sursa (job #2793884) | 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;
}