Pagini recente » Cod sursa (job #2705727) | Cod sursa (job #1724710) | Cod sursa (job #2300048) | Cod sursa (job #37659) | Cod sursa (job #2633639)
#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++;
}
}
}
int x = nrLitere / nrCuvinte;
fout << x;
return 0;
}