Cod sursa(job #330203)

Utilizator Danutza89Serban Maria-Daniela Danutza89 Data 9 iulie 2009 09:38:51
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include<iostream>
#include<fstream>
#include<string.h>
#include<ctype.h>
using namespace std;

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

int main()
{
    char txt[30];
    int nr=0,lung=0,i;
     while(f>>txt)
     {lung=lung+strlen(txt);
     
     for(i=0;i<strlen(txt);i++)
      if(!isalpha(txt[i]))
      lung--;
      nr++;
     }
     cout<<lung;
g<<lung/nr;
g.close();
f.close();

system("pause");
return 0;
}