Cod sursa(job #806090)
Utilizator | Data | 1 noiembrie 2012 20:10:13 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.66 kb |
#include<fstream>
#include<iostream>
using namespace std;
char t;
ofstream g;
ifstream f;
bool lit (char c)
{
if ((t>='A'&&t<='Z')||(t>='a'&&t<='z')) return true;
return false;
}
int main()
{
f.open("text.in");
t=f.get();
int nrlit=0;
int nrc=1;
while (!lit(t)) t=f.get();
while (t!=EOF)
{
if (lit(t))
{
nrlit++;
t=f.get();
}
else
{
nrc++;
while (t!=EOF&&!lit(t)) t=f.get();
if (t==EOF) nrc--;
}
}
f.close();
g.open("text.out");
g<<(nrlit/nrc);
g.close();
return 0;
}