Cod sursa(job #371286)

Utilizator LuffyBanu Lavinia Luffy Data 4 decembrie 2009 19:04:43
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
//while(!feof(f));
#include<stdio.h>
using namespace std;
char x;
int lit,cuv,ok;
int main()
{
 FILE *f=fopen("text.in","r"), *g=fopen("text.out","w");
 
 fscanf(f,"%c",&x); 
 if( (x>64 && x<91) || (x>96 && x<123) )  
 {lit=1; cuv=1; ok=1;}
 
  while(!feof(f))
  {fscanf(f,"%c",&x);
   if( (x>64 && x<91) || (x>96 && x<123) ) 
	{lit++;
     if(!ok) {cuv++; ok=1;}
	}
   else ok=0;
  }
  
fprintf(g,"%d\n",lit/cuv);
fclose(f);
fclose(g);
return 0;
}