Cod sursa(job #1413808)
Utilizator | Data | 2 aprilie 2015 09:27:42 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
# include <fstream>
# include <string.h>
using namespace std;
int main ()
{
char t[1001],sep[]=" !#$%^&*()-=+',./\0123456789?@",*p;
unsigned s=0,cuv=0;
ifstream fin ("text.in");
ofstream fout("text.out");
fin.get(t,1001);
p=strtok(t,sep);
while(p)
{s+=strlen(p);
cuv++;
p=strtok(NULL,sep);
}
if(cuv!=0)
fout<<s/cuv;
else
fout<<0;
fin.close();
fout.close();
return 0;
}