Cod sursa(job #645596)

Utilizator LauuSticlet Laurentiu Andrei Lauu Data 9 decembrie 2011 22:58:03
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
	int nr=0,n=0;
	char s[100],*p,sep[]=" ";
	f.get(s,100);
	f.get();
	p=strtok(s,sep);
	while(p)
	{
		nr=nr+strlen(p);
		p=strtok(NULL,sep);
		n++;
	}
	g<<nr/n;
	return 0;
}