Cod sursa(job #610099)

Utilizator StefanelStefanel Roscan Stefanel Data 24 august 2011 21:14:05
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include<fstream>
#include<string>
using namespace std;

int main()
{
	ifstream f("text.in");
	ofstream g("text.out");
	char sir[256];
	char semne[]=" ,?-!.,;:";
	int l=0,c=0;
	char *p;
	f.get(sir,255);
	f.close();
	p=strtok(sir,semne);
	while(p)
	{
		c++;
		l=l+strlen(p);
		p=strtok(NULL,semne);
	}
	g<<l/c;
	g.close();
	return 0;
}