fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void countWord(FILE *fp, int *count)
  5. {
  6. char word[100];
  7. if (fscanf(fp, "%s", word) == EOF)
  8. return;
  9. if (strlen(word) >= 2)
  10. (*count)++;
  11. countWord(fp, count);
  12. }
  13.  
  14. int main()
  15. {
  16. FILE *fp;
  17. int count;
  18.  
  19. fp = fopen("a.doc", "r");
  20. countWord(fp, &count);
  21. fclose(fp);
  22.  
  23. printf("%d\n", count);
  24.  
  25. return 0;
  26. }
  27.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty