Pagini recente » Cod sursa (job #1336130) | Cod sursa (job #1748544) | Cod sursa (job #2852224) | Cod sursa (job #385212) | Cod sursa (job #2437912)
// Example program
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream o("text.out");
int avg,len,wordc;
char *pok,text[1024*1024 +1];
int main()
{
f.getline(text,1024*1024 +1);
//cin.get();
pok=strtok(text," ,.-_;:()!?`1234567890");
while(pok!=NULL)
{
len+=strlen(pok);
wordc++;
pok=strtok(NULL," ,.-_;:()!?!1234567890");
}
avg=len/wordc;
//cout<<len<<wordc;
o<<avg;
return 0;
}