Cod sursa(job #27535)

Utilizator adyzahoAdrian Zahoi adyzaho Data 6 martie 2007 15:02:10
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include"fstream.h"
#include"string.h"
int main()
{
 ifstream in("text.in");
 ofstream out("text.out");
 long lung=0,nc=0,lc=0;
 int i;
 char c[2];
 while(!in.eof())
 {
  in.get(c,2);
  if( ((strcmp(c,"a")>=0) && (strcmp(c,"z")<=0))||((strcmp(c,"A")>=0)&&(strcmp(c,"Z")<=0)))
   lc++;
  else
   if(lc);
   {
    lung+=lc;
    nc++;
    lc=0;
   }
 }
 out<<(int)lung/nc;
 in.close();
 out.close();
 return 0;
}