Cod sursa(job #355761)
Utilizator | Marian S eu93 | Data | 12 octombrie 2009 08:36:19 |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | CNRV #2 | Marime | 0.25 kb |
#include <fstream.h>
int main()
{ char c;
int k=0,s=0,p=0;
ifstream f("text.in");
ofstream g("text.out");
while (f>>c) { g<<c;
if (c==" ") p++;
else if (isalpha(c)) k++;
else {s+=k;k=0; }
}
g<<s/p;
f.close();
g.close();
return 0;
}