Pagini recente » Cod sursa (job #1318556) | Cod sursa (job #2556965) | Cod sursa (job #1580271) | Cod sursa (job #2633355) | Cod sursa (job #1022575)
#include<iostream>
#include<fstream>
using namespace std;
bool eLitera(char c){
if ((c >= 'a'&&c <= 'z') || (c >= 'A'&& c <= 'Z')){
return true;
}
return false;
}
int main(){
ifstream f("text.in");
char c = NULL;
int cuvinte=0;
int litere = 0;
int s = 0;
while (f.get(c)){
if (eLitera(c)){
litere++;
}
else{
if (litere) cuvinte++;
s += litere;
litere = 0;
}
}
ofstream o("text.out");
o << s / cuvinte;
return 0;
}