Cod sursa(job #1726087)
Utilizator | Data | 7 iulie 2016 11:45:27 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream f("text.in");
ofstream g("text.out");
char c;
int words = 0, letters = 0;
bool ok = 0;
while (!f.eof())
{
f.get(c);
if (isalpha(c))
{
letters++;
ok = true;
}
else if (ok == true)
{
words++;
ok = false;
}
}
g<<letters / words;
return 0;
}