Cod sursa(job #371272)

Utilizator LuffyBanu Lavinia Luffy Data 4 decembrie 2009 18:46:48
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#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(x!='\n')
  {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;
}