Guest User

Untitled

a guest
Jan 12th, 2018
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. #define MAX_WORD_LENGTH 50
  7. #define MAX_WORDS 100
  8.  
  9. int main(void)
  10. {
  11. char word[MAX_WORD_LENGTH];
  12.  
  13. char wordList[MAX_WORDS][MAX_WORD_LENGTH];
  14. int wordCount = 0;
  15. int i;
  16. int found=0;
  17.  
  18. FILE *fp;
  19. fp=fopen("C:\\Users\\Kirsten\\Documents\\Visual Studio 2010\\Projects\\Lab 10\\Lab10Resources\\ex1\\words.txt","r");
  20.  
  21. if (fp==NULL) {
  22. printf("file did not open");
  23. }
  24.  
  25.  
  26.  
  27.  
  28. fscanf(fp, "%s", word);
  29. printf("%s", word);
  30.  
  31. //wordList[0][MAX_WORD_LENGTH]=word;
  32. //printf("%s", wordList[0][MAX_WORD_LENGTH]);
  33.  
  34. //while (fscanf(fp, "%s", word)!= EOF) {
  35.  
  36. /*while (found==0) {
  37. for (i=0;i<=wordCount;i++) {
  38. if (strcmp(word, wordList[i])==0) {
  39. found++;
  40. }
  41. }
  42. printf(word);
  43. printf("\n");
  44. }*/
  45.  
  46. //}
  47. /*while (fscanf(fp, "%s", word) != EOF) {
  48. strcpy(wordList[0], word);
  49. for (i=0; i<=wordCount; i++) {
  50. if(strcmp(word, wordList[i]) != 0) {
  51. strcpy(wordList[i], word);
  52. wordCount++;*/
  53.  
  54. fclose(fp);
  55.  
  56. return 0;
  57. }
Add Comment
Please, Sign In to add comment