Cod sursa(job #501524)

Utilizator AlecSsNumber one is AlecSs Data 15 noiembrie 2010 15:52:26
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include<fstream>
#include <string.h>
using namespace std;

int main()
{
    char s[256],sep[]=" 0123456789 ;-,!?_",*p;
    int nr_cuv=0,nr_caractere=0;
    ifstream fin("text.in");
    
    while(!fin.eof())
    {
                     fin.getline(s,256);
                     
    p=strtok(s,sep);
    while (p)
      {
          nr_caractere+=strlen(p);
          nr_cuv++;
          p=strtok(NULL,sep);
          }
          }
     fin.close();
     ofstream fout("text.out");     
    fout<<nr_caractere/nr_cuv;
    fout.close();
    system("pause");
    return 0;
}