Cod sursa(job #2110681)

Utilizator constantin.gabrielConstantin Gabriel constantin.gabriel Data 21 ianuarie 2018 10:06:43
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[256];
long long sum,nr;
int main()
{
    f.get(s,256);
    char * pch;
    pch = strtok (s," ,.-!?");
    while (pch != NULL)
    {
        sum+=strlen(pch);
        nr++;
        pch = strtok (NULL, " ,.-!?");
    }
    g<<sum/nr;
}