Cod sursa(job #637115)
Utilizator | Data | 20 noiembrie 2011 12:04:10 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<iostream>
#include<string.h>
#include<fstream>
using namespace std;
int main()
{char s[256], *p, sep[]=" ,?!-";
int nch=0 ,nsb=0;
ifstream F("text.in",ios::in);
ofstream G("text.out",ios::out);
F.getline(s,256);
p=strtok(s,sep);
while(p)
{nsb++;
nch+=strlen(p);
p=strtok(NULL,sep);
}
G<<nch/nsb;
return 0;
}