Cod sursa(job #2132974)
Utilizator | Mihai-Cristian Popescu mihai50000 | Data | 16 februarie 2018 12:52:12 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
short unsigned int s = 0, k = 0;
char a;
int ok = 0;
bool litera(char a)
{
if ((a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z'))
return 1;
return 0;
}
int main()
{
while (f.get(a))
{
if (litera(a) == 1)
{
s++;
if (ok == 0)
{
k++;
ok = 1;
}
}
else ok = 0;
}
g << s / k;
}