Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <stdlib.h>
  4. #include <ctype.h>
  5. #include <string.h>
  6.  
  7. typedef struct word {
  8. int count;
  9. char *Word;
  10. } WORD;
  11.  
  12. int main()
  13. {
  14. int N=0;
  15. WORD Vocabulary[300000];
  16. FILE *I;
  17. char str[1000] , s[100];
  18. char filename[256];
  19. printf("Введите название файла:\n ");
  20. scanf("%s", filename);
  21.  
  22. I=fopen(filename,"r");
  23. if (I==0)
  24. {
  25. printf("Файл %s не удалось открыть! \n",filename);
  26. exit(0);
  27. }
  28. while (fgets(str, 1000, I)!=NULL)
  29. {
  30. while(strtok(str, " ,.")!=NULL)
  31. {
  32. Vocabulary[N].Word=malloc(strlen(s)+1);;
  33. strcpy(Vocabulary[N].Word, s);
  34. printf("%s n", Vocabulary[N].Word);
  35. N++;
  36. }
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement