Cod sursa(job #862913)
Utilizator | Data | 23 ianuarie 2013 00:41:36 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
char s[255], *p;
int sum=0, nr=0;
ifstream fin ("text.in");
ofstream fout ("text.out");
fin.getline(s, 255, '\n');
p=strtok(s, "-,. ");
while (p)
{
sum+=strlen(p);
nr++;
p=strtok(NULL, "-,. ");
}
fout<<sum/nr;
return 0;
}