Cod sursa(job #1036505)

Utilizator T.C.11Tolan Cristian T.C.11 Data 19 noiembrie 2013 13:55:59
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <fstream>
#include <cstring>

using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");

char cuv[1000],*p,sep[]=".,-!?<>=+ ";
int nr,nrcuv;

int main()
{
    while (fin.get(cuv, 1000))
    {
        p=strtok(cuv,sep);
        while (p!=NULL)
        {
            nr+=strlen(p);
            nrcuv++;
            p=strtok(NULL,sep);
        }
        fin.get();
    }
    fout<<nr/nrcuv;
    return 0;
}