Pagini recente » Cod sursa (job #56939) | Cod sursa (job #1637359) | Monitorul de evaluare | Cod sursa (job #2768990) | Cod sursa (job #2633637)
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main() {
int nrCuvinte = 0,nrLitere = 0;
char ch;
bool anyLetter = 0;
while(fin.get(ch)) {
if (isalpha(ch)) {
nrLitere++;
anyLetter = 1;
}
else
{
if (anyLetter == 1)
{
anyLetter = 0;
nrCuvinte++;
}
}
}
fout << nrLitere / nrCuvinte;
return 0;
}