Cod sursa(job #31263)

Utilizator gabitzish1Gabriel Bitis gabitzish1 Data 15 martie 2007 18:40:57
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include<stdio.h>
#include<string.h>

char s[1000];

void citire()
{
  FILE *f=fopen("text.in","r");
  fgets(s,1000,f);
  fclose(f);
}

void calcul()
{
  int c=0, suma=0;
  char *p;
  p=strtok(s," ,.;:[]}{/\-=+_!?><'()");
  suma+=strlen(p);
  c++;
  while (p!=NULL)
    {
      p=strtok(NULL," ,.;:[]}{/\-=+_!?><'()");
      suma+=strlen(p);
      c++;
    }
  FILE *g=fopen("text.out","w");
  fprintf(g,"%d",suma/(c-1));
  fclose(g);
}

int main()
{
  citire();
  calcul();
  return 0;
}