Cod sursa(job #14926)

Utilizator bacerandreiBacer Andrei bacerandrei Data 10 februarie 2007 11:45:54
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include<string.h>
#include<fstream.h>
char sir[1000000],sep[]=" ,-?!;:.",*p;
long int nr=0,n1,s;
int main()
{
  ifstream f("text.in");
  ofstream g("text.out");
  f.get(sir,1000000);
   f.close();
  p=strtok(sir,sep);
  while(p)
  {
    n1=strlen(p);
    nr++;
    p=strtok(NULL,sep);
    s+=n1;
  }
  g<<s/nr;
  g.close();
  return 0;

}