Pagini recente » Cod sursa (job #2864718) | Cod sursa (job #27414) | Rating Jugariu Daniel (Daniel237) | Cod sursa (job #2613396) | Cod sursa (job #1513071)
#include <fstream>
#include <iostream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main() {
char x;
int total = 0;
int words = 0;
bool should = false;
while (f>>noskipws>>x) {
if ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z')) {
total++;
should = true;
} else if (should) {
should = false;
words++;
}
}
g<<total/words<<endl;
f.close(); g.close();
return 0;
}