Cod sursa(job #139602)

Utilizator diatarmure15tarmure diana diatarmure15 Data 20 februarie 2008 14:39:50
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <fstream>
using namespace std;
int main()
{ 
     ifstream f("text.in");
     char x;
     int cuvant,nr_cuv=0,lung_cuv=0;
     x=f.get()
     ;cuvant=0;
   
   
     while (!f.eof())
     {
           if ((x>=65&&x<=90)||(x>=97&&x<=122))
           {if (cuvant==0) {cuvant=1;nr_cuv++;}
              lung_cuv++;
              }
              else
               cuvant=0;
              
             x=f.get() ;
              }
           
     f.close();
     ofstream g("text.out");
     g<<lung_cuv/nr_cuv;
     g.close();
     return 0;
     }