Pagini recente » Cod sursa (job #330180) | Statistici Pene Cosmin-Octavian (penetavy) | Cod sursa (job #2390640) | Monitorul de evaluare | Cod sursa (job #1998302)
#include <iostream>
#include <stdio.h>
#include <fstream>
using namespace std;
int main() {
char x;
int q = 0, l = 0, c = 1;
ifstream citire("text.in");
ofstream afisare("text.out");
while (true) {
citire.get(x);
if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z') {
l++;
break;
}
}
do {
citire.get(x);
q = 0;
if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z')
l++;
else
while (q == 0) {
citire.get(x);
if (citire.eof())
break;
if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z') {
l++;
q = 1;
}
}
if (q == 1)
c++;
} while (!citire.eof());
afisare << l << ' ' << c << ' ' << l / c;
citire.close();
afisare.close();
return 0;
}