Cod sursa(job #334787)

Utilizator iulia609fara nume iulia609 Data 27 iulie 2009 23:41:52
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include<stdio.h>
using namespace std;

int main()
{ int k, cont, ok;
  char c;
  
	  FILE *f = fopen("text.in", "r");
	  FILE *g = fopen("text.out", "w");
	  
	  fscanf(f, "%c", &c);
	  k = cont = ok = 0;
	  while(c != '\n')
		  {
			  if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
					  {
						  k++;
				  		  if(!ok) cont++;
						  ok = 1;
					  }    else ok = 0;
					  
				  
			  fscanf(f, "%c", &c);
		  }
	  
	  fprintf(g, "%d\n", k/cont);
	  
	  fclose(f);
	  fclose(g);
	  return 0;
}