Cod sursa(job #599288)
| Utilizator | Data | 28 iunie 2011 14:22:04 | |
|---|---|---|---|
| Problema | Text | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<fstream>
#include<cstring>
#include<iostream>
using namespace std;
int main()
{char c;
int cuv=0,lit=0,ok=0;
ifstream f("text.in");
while (!f.eof())
{c=f.get();
while ((c>='a' && c<='z') || (c>='A'&& c<='Z'))
{lit++;
c=f.get();
ok=1;
}
if (c==' ')
{cuv++;
ok=0;
}
if (c=='-' && ok==1)
cuv++;
ok=0;
}
ofstream g("text.out");
cout<<lit/cuv;
g<<lit/cuv;
f.close();
g.close();
return 0;
}
