Cod sursa(job #292567)

Utilizator dad14Dascalu Daniel-Alexandru dad14 Data 31 martie 2009 11:50:55
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include<fstream.h>
#include<string.h>
#define l 1001
char a[l];
int main()
{
int i=0;
ifstream f("text.in");
ofstream g("text.out");
f.getline(a,l);
char *p=a;
char sep[]=",.!?- 123456789)({}[]:;";
int s=0;
int n=0;
p=strtok(a,sep);
while(p)
{
strcpy(a,p);
s+=strlen(a);
p=strtok(NULL,sep);
 i++;
 }
 g<<s/i;
 f.close();
 g.close();
 return 0;
 }