Cod sursa(job #1363363)

Utilizator george.buneaFMI George Bunea george.bunea Data 26 februarie 2015 22:05:30
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <fstream>
#include <string.h>

using namespace std;

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

    char s[1024],*p;
    int sum=0,nr=0,i;
    f.get(s,1023);
    p=strtok(s," ");
    while(p){
        sum+=strlen(p);
        nr++;
        p=strtok(0," ");
    }
    g<<sum/nr;


    return 0;
}