Cod sursa(job #1725841)
Utilizator | Data | 6 iulie 2016 16:16:26 | |
---|---|---|---|
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;
}