Cod sursa(job #778926)

Utilizator slyfer12Damian Alexandru slyfer12 Data 16 august 2012 11:46:55
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <fstream>
#include <ctype.h>

using namespace std;

int main()
{ char x;
  int cuv=0,lit=0,t=0;
 ifstream f("text.in");
 ofstream g("text.out");
   while(!f.eof()){
       f.get(x);
       if(isalpha(x))
       {lit++;
       t=1;}
         else
           if((isprint(x) || isspace(x)) && t)
           {cuv++;
           t=0;}}

    g<<lit/cuv;
    return 0;
}