Cod sursa(job #534558)

Utilizator orianaOriana oriana Data 15 februarie 2011 20:39:56
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<fstream>
#include <iomanip.h>
using namespace std; 
ifstream f ("text.in"); 
ofstream g ("text.out"); 
int i=1,ok,s,c=1;
char v;
int main ()
{while (!f.eof())
	{f>> resetiosflags (ios::skipws) >>v;
	if ((v>='A'&&v<='Z')||(v>='a'&&v<='z'))
		{s=s+1;ok=1;}
	else if ((v==' '||v=='_'||v==','||v=='.'||v=='!'||v=='?'||v=='-'||v==';'||v==':')&&ok)
		{c=c+1;ok=0;}
	cout<<s<<' '<<c<<'\n';}
g<<(s-1)/c;
}