Cod sursa(job #792788)
| Utilizator | Data | 30 septembrie 2012 12:50:45 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
#include <ctype>
using namespace std;
int main()
{
ifstream f("text.in");
ofstream g("text.out");
char c,c2;
unsigned int wordNr=0, textLength=0;
while(!f.eof())
{
c2=c;
f.get(c);
if(isalpha(c))
textLength++;
if((c==' ' || c=='-') && (c2!=' ' && c2!='-'))
wordNr++;
}
g<<(int)textLength/wordNr;
}
