Cod sursa(job #741797)

Utilizator vatavu_oanavatavu oana vatavu_oana Data 26 aprilie 2012 23:16:38
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<fstream>
#include<iostream>
#include<string.h>
 using namespace std;
 ifstream f("o.in");
 ofstream g("o.out");
 int k=0,nr=0,i;
 char *p,a[256]="",b[11]=" -:.;',?!	";
 int main()
{
 while(f.getline(a,256))
	 {
	  while(a[0]=='-'||a[0]=='"'||a[0]==' ')
		 strcpy(a,a+1);
	  p=strtok(a,b);
	  while(p)
		 {
		  nr+=strlen(p);
		  k++;
		  p=strtok(NULL,b);
		 }
	 }
  if(k)
	 g<<(int)nr/k<<' '<<nr<<' '<<k;
 f.close();
 g.close();
 return 0;
}