Cod sursa(job #2244045)

Utilizator davidmarianDavid Marian davidmarian Data 21 septembrie 2018 22:03:19
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;

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

int main()
{
    char f[256], *p;
    int ct=0,lung=0;
    f.getline(f,256);
    p=strtok(f," .,-");

    while(p!=NULL)
    {
        ct++;
        lung+=strlen(p);
        p=strtok(NULL, " .,-");
    } g<<lung/ct;
f.close();
g.close();
    return 0;
}