Cod sursa(job #768437)
| Utilizator | Data | 16 iulie 2012 20:19:06 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
long int cuvinte, litere;
char a;
int main(void)
{
f>>a;
while(!f.eof())
{
if(a>='a' && a<='z' || a>='A' && a<='Z')
{
++cuvinte;
while(!f.eof() && (a>='a' && a<='z' || a>='A' && a<='Z'))
{
++litere;
f.get(a);
}
}
else while(!f.eof() && !(a>='a' && a<='z' || a>='A' && a<='Z'))
f.get(a);
}
f.close();
g<<litere/cuvinte;
g.close();
return 0;
}
