Cod sursa(job #223647)

Utilizator lucifixNamuleac Lucian lucifix Data 28 noiembrie 2008 23:23:18
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<fstream.h>
#include<string.h>
ifstream f( "text.in");
ofstream g("text.out");
char sp[]="-,./",a[250],*p,*q;
void cautare()
{for(p=sp;*p!=NULL; p++)
{q=strchr(a,*p);
while(q)
{strcpy(q,q+1);
 q=strchr(a,*p);
 }
}
void main()
{f.get(a,250);
f.close();
 cautare();
 p=strstr(a,"  ");
 while(p)
 {strcpy(p,p+1);
 p=strstr(a,"  ");
 }
 nr=0,nr2=0;
 p=strtok(a," ");
 while(p)
 {nr++; nr2=strlen(p);
 p=strtok(NULL," ");
 }
 g<<nr/nr2;
 g.close();
 }