Cod sursa(job #897798)

Utilizator Sergiu15Olive O Sergiu15 Data 27 februarie 2013 22:16:38
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<iostream>
#include<stdlib.h>
#include<fstream>
#include<string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main ()
{
    char sir[256],*p,sep[]=" ,!-:;.";
    float nc=0,nl=0;
    f.get(sir,255);
    p=strtok(sir,sep);
    while(p)
    {
        nc++;
        nl+=strlen(p);
        p=strtok(NULL,sep);
    }
    g<<int(nl/nc);
}