Cod sursa(job #1857632)

Utilizator VictorAndreiCotescu Victor Andrei VictorAndrei Data 26 ianuarie 2017 14:50:07
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <string.h>
#include <fstream>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int main()
{
        char s[256], *p;
        int S=0, nr=0;
        f.getline(s, 256);
        p=strtok(s, " -,.!?;");
        while(p)
        {
            S=S+strlen(p);
            nr++;
            p=strtok(NULL, " -,.!?;");
        }

            g << S/nr;
}