Cod sursa(job #2443650)
Utilizator | Data | 28 iulie 2019 22:50:01 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text[256];
int nrCuv, nrLitere;
int main() {
while(!f.eof()) {
f.getline(text, 255);
for(unsigned int i = 0; i < strlen(text); i++)
if(isalpha(text[i])) {
nrLitere++;
if(!isalpha(text[i-1]) || i == 0)
nrCuv++;
}
}
g << nrLitere / nrCuv;
}