Cod sursa(job #2668)
Utilizator | Data | 18 decembrie 2006 17:14:09 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<fstream>
#include<iostream>
#include<string>
using namespace std;
int main()
{
char a[1000],*t,sep[]=" ,.;:-!?`_()";
int lt=0,nrc=0;
ifstream fin("text.in");
ofstream fout("text.out");
fin.get(a,100);
t=strtok(a,sep);
while(t)
{
lt=lt+strlen(t);
nrc++;
t=strtok(NULL,sep) ;
}
fout<<lt/nrc;
fin.close();
fout.close();
return 0;
}