Cod sursa(job #1159241)

Utilizator silvatheviprersilviu catioiu silvatheviprer Data 29 martie 2014 14:07:00
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <fstream>
#include <string.h>
using namespace std;
fstream f("text.in", ios::in);
fstream g("text.out", ios::out);
char *p, s[256], aux[256] ;
int nl, nc;
int main()
{   f.get(s,256);
    p=strtok(s,"- ,.?!");
    while (p)
    {
        nc++;
        strcpy(aux,p);
         nl += strlen(aux);
          p = strtok(NULL, "- ,.?!");
    }
    g << nl / nc;
    return 0;
}