Cod sursa(job #58467)

Utilizator SuRfEr88Lord Anak1n SuRfEr88 Data 5 mai 2007 22:07:45
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <stdio.h>
#include <string.h>
#include <ctype.h>

main()
{
  char s[100];
  int i, k=0, c=0;
  FILE *f1, *f2;
  f1 = fopen("text.in","r");
  f2 = fopen("text.out","w");
  fgets(s, 100, f1);
  for(i=0;i<strlen(s);i++)
    if (isalpha(s[i])) k++;
  i=0;
  while (i<strlen(s))
  {
    if (isalpha(s[i]))
    {
      c++;
      while (isalpha(s[i])) i++;
    } else i++;
  }
  fprintf(f2, "%d", k/c);
  fclose(f2);
}