Cod sursa(job #2437913)
Utilizator | Data | 10 iulie 2019 18:43:11 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
// 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," ,.-_;:()!?`1234*@#$%^&567890'[]{}=+\|/<>");
while(pok!=NULL)
{
len+=strlen(pok);
wordc++;
pok=strtok(NULL," ,.-_;:()!?`1234*@#$%^&567890'[]{}=+\|/<>");
}
avg=len/wordc;
//cout<<len<<wordc;
o<<avg;
return 0;
}