Cod sursa(job #269787)
| Utilizator | Data | 3 martie 2009 13:40:52 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <fstream>
using namespace std;
fstream f;
fstream g;
char c;
int words;
int letters;
int flag;
int main()
{
f.open("text.in",fstream::in);
flag=0;
g.open("text.out",fstream::out);
f >> noskipws;
while(!f.eof())
{
f >> c;
if(c>64&&c<91||c>96&&c<123)
{
letters++;
if(!flag)
{
words++;
flag=1;
}
}
else
flag=0;
}
g << (letters/words) << "\n";
g.close();
return 0;
}
