Cod sursa(job #356242)

Utilizator mirunababliucMiruna Babliuc mirunababliuc Data 13 octombrie 2009 22:12:41
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <fstream.h>
#include <ctype.h>
int main ()
{ifstream f("text.in");
ofstream g("text.out");
int k=0,nr=0,ma,ok=0;
char c;
f>>c;
while (!f.eof())
	{ if (isalpha(c)) { nr++; ok=1;}
        else  if (ok==1) { k++; ok=0;}
	  f>>c;
	}
if (ok==1) k++;
ma=nr/k;
g<<ma;
f.close ();
f.close ();
return 0;
}