Cod sursa(job #139597)
Utilizator | andrei andi_sz | Data | 20 februarie 2008 14:33:25 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream f("text.in");
char x;
int cuvant,nr_cuv=0,lung_cuv=0;
f.get(x);cuvant=0;
while (!f.eof())
{
if ((x>=65&&x<=90)||(x>=97&&x<=122))
{if (cuvant==0) {cuvant=1;nr_cuv++;}
lung_cuv++;
}
else
cuvant=0;
f.get(x);
}
f.close();
ofstream g("text.out");
g<<lung_cuv/nr_cuv;
g.close();
return 0;
}