Cod sursa(job #2069194)
Utilizator | Data | 18 noiembrie 2017 12:22:30 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | evaluare_cex_sv_cls_x | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char c;
int cuvinte=0,litere=0, ok = 0;
while (f)
{
f.get(c);
if (isalpha(c))
{
litere++;
ok = 1;
}
else if (ok)
{
cuvinte++;
ok = 0;
}
}
if (cuvinte == 0)
cuvinte = 1;
g << litere/cuvinte;
}