Cod sursa(job #1670598)
Utilizator | Data | 31 martie 2016 21:11:55 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <fstream>
using namespace std;
int main()
{
int w = 0;
int l = 0;
bool i = false;
ifstream f("text.in");
char c;
while (f.get(c))
{
if (isalpha(c))
{
l++;
i = true;
}
else if (i)
{
w++;
i = false;
}
}
f.close();
if (isalpha(c) && i)
{
w++;
}
ofstream o("text.out");
o << l / w;
o.close();
return 0;
}