Cod sursa(job #534150)
Utilizator | Data | 15 februarie 2011 12:42:57 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<fstream>
#include<string.h>
using namespace std;
ifstream f ("text.in");
ofstream g ("text.out");
int nr,s,n;
char a[10000],*p,sep[]="!. ,:?-";
int main ()
{f.get(a,10000);
p=strtok(a, sep);
while ( p )
{n=strlen(p);
s=s+n;
nr++;
p=strtok(NULL, sep);
}
g<<s/nr;
}