Cod sursa(job #292562)
Utilizator | Data | 31 martie 2009 11:48:22 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 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,200);
char *p=a;
char sep[]=",.!?- ";
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;
}