Cod sursa(job #334789)

Utilizator iulia609fara nume iulia609 Data 28 iulie 2009 00:00:46
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 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");
	  
	  
	  k = cont = ok = 0;
	  while(fscanf(f, "%c", &c) != EOF)
		  {
			  if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
					  {
						  k++;
				  		  if(!ok) cont++;
						  ok = 1;
					  }    else ok = 0;
					  
				  
			  //fscanf(f, "%c", &c);
		  }
	  if(cont != 0)
	  fprintf(g, "%d %d\n", k,cont);
	  else fprintf(g, "%0\n");
	  fclose(f);
	  fclose(g);
	  return 0;
}