Cod sursa(job #1134196)
Utilizator | Data | 6 martie 2014 10:22:07 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream>
#include <cstring>
using namespace std;
int main()
{
char s[101],sep[]=".,;:!-? ",a[100][100],*p;
int n,i,suml;
ifstream fin("text.in");
ofstream fout("text.out");
fin.getline(s,100);
p=strtok(s,sep);
n=0;
while(p)
{
strcpy(a[n],p);
n++;
p=strtok(NULL,sep);
}
suml=0;
for(i=0;i<n;i++)
suml+=strlen(a[i]);
fout<<suml/n;
return 0;
}